Wrong dates on files saved to SD card
-
Hi.
Was wondering if anyone had a explanation for, why the dates of files i create and write to on my FiPy is showing wrong dates?
I have a program that samples from a sensor, and saves the data to a file on my SD card when done sampling.
I just noticed, when i inserted my SD card into my laptop, that the dates of the files (last modified), is totally wrong, showing me dates from the 31st of december 1999 and up to 1st of january 2000... For files that were created and written to on the 4th of june!
I seems that the filesystem is using an "epoch" date of 1st of january 2000. But how can i happen that it's giving me dates from newyearseve 1999?
Naturally i assumed that since i did not sync the RTC prior to writing in the file, it was giving me these old dates. So i then synced the RTC, and made sure that it gives me a correct timestamp when calling rtc.now().
But the file now says, that it was last modified in 2050 (the time of day is however correct)?
It looks like a bug to me?
-
@railmonitor said in Wrong dates on files saved to SD card:
I seems that the filesystem is using an "epoch" date of 1st of january 2000. But how can i happen that it's giving me dates from newyearseve 1999?
MicroPython does not care for timezones. It always assumes UTC. Since you PC does know timezones, there can be differences of a few hours. And unless you set the time of your FiPy properly, the time stamp value will start January 1st, 2000 on every boot.
The Linux epoch time is January 1st, 1970. That may cause the 30 years difference. So it looks like the compensation for the epoch times difference is applied twice.
May I ask you to raise an issue. That ensures that this glitch does not get lost and will eventually be fixed.
-
@robert-hh Yes:
(sysname='FiPy', nodename='FiPy', release='1.20.2.rc6', version='v1.11-01f49f7 on 2020-02-28', machine='FiPy with ESP32', lorawan='1.0.2', sigfox='1.0.1', pybytes='1.3.1')Used with a Pysense board!
-
@railmonitor May I ask for the firmware version you are using?