file creation date and time in sd card works but 5 hours offset in Linux

I create a data-logger routine and successfully implemented the call back function to add the file date and time as described here:
https://forum.arduino.cc/index.php?topic=348562.msg2404447#msg2404447
Now here's the odd part, when I insert the SD card in my Linux Mint 19.3 computer, it reports the correct date but the hours are 5 hours late, i.e. reports 1:00pm when it actually should be 6:00pm. If I insert the same sd card into my Windows 10 computer, the date and time are correct. Could it be a time zone thing? I haven't experienced anything like this on any other use of SD cards on either computer. The code was built/compiled on the Linux computer but I did also try on the Windows 10 and got the same results.

What's your local time relative to UTC?

barriebarry:
I create a data-logger routine and it reports the correct date but the hours are 5 hours late, i.e. reports 1:00pm when it actually should be 6:00pm. If I insert the same sd card into my Windows 10 computer, the date and time are correct.

Pretty clearly a Linux problem, but it might just be the way Arduino formats the data into something Linux doesn't understand. I understand that you are simply passing recorded data, and some of that data reads as time to a human, but it is just data, so time zones and the like have nothing to do with it.

It might be time to post your code...

My time zone is Eastern and therefore UTC minus 5 hours but the time reported is UTC minus 10 hours. If I were to guess what's happening, the Linux OS is likely looking for a flag to tell it that the file is FAT format vs some other Linux format (ext4 or something like that). I know Linux enough to use applications on it but my knowledge on the nuts and bolts of the OS is rather limited.

Linux and Windows both handle time in an internally consistent manner, but the time zone offset is treated in different ways, relative to the on board PC clock. People with dual boot systems see this all the time.

I don't think you can switch between Windows based and Linux based systems without expecting this difference to crop up somewhere, and as far as I can tell, it has to be treated on a case to case basis.

Linux time stamps are consistent across platforms, as long as the epoch is chosen consistently.

barriebarry:
My time zone is Eastern and therefore UTC minus 5 hours but the time reported is UTC minus 10 hours.

Probably irrelevant. It presupposes that Linux can tell the data you sent it is time, and the only way it will think you live in Honolulu is because you specifically said so, and instructed it to change specific data accordingly.

If Linux was somehow reading Arduino's clock, the time might be relevant but, as I understand it, you are simply reading data off an SD card. Is that correct?

I note you are disinclined to post your code, and some indication of what's going on at the Linux end might be helpful - to a Linux person.

Likely related to the fact that linux usually sets the system clock to UTC, while Windows uses local time.

This may help to get your linux and windows pc's on the same page for interpreting local time:

How to Fix Windows and Linux Showing Different Times When Dual Booting

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.