SD-timestamp uncorrect reading in Windows 10

The timestamp of files written on a SD with arduino seems shifted 1 hour back in time. Can anybody explain me this?
The following is an exemplificative firmware:

#include <SD.h>
File myFile;
uint8_t HOUR;

void dateTime(uint16_t* date, uint16_t* Time) {
*date = FAT_DATE(2000, 1, 1);
*Time = FAT_TIME(HOUR,0,0);
}

void setup() {
if (!SD.begin(3)) while(1);

for (HOUR = 0; HOUR < 25; HOUR++){
SdFile::dateTimeCallback(dateTime);
String filename = “test”; filename += HOUR; filename += “.txt”;
myFile = SD.open(filename, FILE_WRITE);
if (myFile){
myFile.println(“test”);
myFile.close();
}
}
}

void loop() {}

The attached figure shows the appearing in Windows Explorer.

Thanks in advance for any tip.

I guess that the FAT filesystem is treating the time you give it as a UTC time. When you look at the created file on your PC, it is displaying the file's time stamp according to your local time zone settings. To test this, you could temporarily set your PC timezone to UTC.

You are absolutely right, thank you.

Now the question is: is it possible to save the time zone in the timestamp written by Arduino?

6v6gt: I guess that the FAT filesystem is treating the time you give it as a UTC time. When you look at the created file on your PC, it is displaying the file's time stamp according to your local time zone settings. To test this, you could temporarily set your PC timezone to UTC.

The simple solution is to simply run the Arduino (or the RTC) in UTC instead of local time. That way it always creates timestamps in UTC. If you don't want to do that, you have to convert the local time to UTC each time you create a time stamp for the file. You can use time library functions to do such convertions.

There is still someting that I don't undersand: why the time shown for files created with Windows does not change whatever is the PC setting (UTC, UTC+1, etc.)?

Maybe there is someting missing when saving the timestamp with Arduino?

6v6gt: The simple solution is to simply run the Arduino (or the RTC) in UTC instead of local time. That way it always creates timestamps in UTC. If you don't want to do that, you have to convert the local time to UTC each time you create a time stamp for the file. You can use time library functions to do such convertions.

Have a look at the various time libraries (TimeLib and TimeZone for example) which contain a host of methods for dealing with Arduino times. From my limited experience of SD cards, what you write to them is what you get and logging times hasn't been a problem. There are lots of data-logging examples available. A few serial prints might help show where it's going wrong, but a nice round hour does point to a timezone problem, but even so, it's easy to correct using the libraries. An RTC would be a useful addition A nice round hour does suggest a timezone problem. Judging from the date, you might have just had a DST adjustment

protoritmo: There is still someting that I don't undersand: why the time shown for files created with Windows does not change whatever is the PC setting (UTC, UTC+1, etc.)?

. . .

You mean that when you examine an SD file on the arduino which was created on the PC ? The PC will also write the timestamp in UTC. If you change the timezone on the PC from your standard timezone to something else, but then don't change the local time, then the UTC time is still the same. So what is written on the SD card will not change. However, if having changed the timezone on the PC, then you correct the local time so the PC clock shows the correct local time (although the time zone is incorrect) then the UTC time will be different. You probably have to work with concrete examples to see this.

Sorry, my description was unclear. I am talking of what I see in Windows Explorer having the SD card inserted into the PC: on the SD card there are some files created with Arduino and other files created with the PC. By changing the PC time zone, only the timestamps of the files created with Arduino are updated in Explorer, while those created with Windows never change.

I agree with tigger that it is a problem related to DST, because the change of the timestamp in Explorer is never more than 1 hour for any time zone setting. But why only the timestamps of the files created with Arduino are updated by Explorer?

6v6gt: You mean that when you examine an SD file on the arduino which was created on the PC ? The PC will also write the timestamp in UTC. If you change the timezone on the PC from your standard timezone to something else, but then don't change the local time, then the UTC time is still the same. So what is written on the SD card will not change. However, if having changed the timezone on the PC, then you correct the local time so the PC clock shows the correct local time (although the time zone is incorrect) then the UTC time will be different. You probably have to work with concrete examples to see this.