Time returned is not correct

Hi all,

I have a temperature and GPS data logger using IMP003. It works mostly offline and when it is brought in to a location with WIFI it transmits the logged data. I am having an issue with the time reported as it has been offset to Sat, 01 Jan 2000 19:00:40, the correct date should of been Thursday, 28 July 2016. This is the EPOCH reported by the IMP 946753240000. This only happened when the logger is sent out on long trips. It normally reports the correct EPOCH.

What I suspect is that the IMP ran out of battery and when I was charged backup and it was not able to connect to WIFI the time did not get synced correctly. Could this be the case?

Yes, most likely. The time ticks up from 1/1/2000 when the device has never connected to the server. After server connection, the RTC is updated and will then work across sleeps etc. Note that the imp needs to be able to process packets from the server for this to work, so your code has to yield after connection to allow the time to be set.

If you have GPS though, maybe log the time in the GPS stream? You have a source of truth there :slight_smile:

This is added hardware, but another option for you:

You would still have the issue of daylight savings time and timezone changes.

With regards to the RTC addon… maybe you could set the time to ZULU time or UTC so that the raw data is absolute/universal. Then output it if needed using offsets for local time and daylight savings in effect.