Hello, in my Photon’s code I call
Time.now() at the start of the setup function
The returned value often (I discovered it happens when the device is powered on after it hasn’t been
active for at least a couple of minutes. It never happens if I reset of flash the device) is 944006400 which is the timestamp for December 1, 1999 0:00:00
I already solved the issue by checking the given value and executing
Particle.syncTime() if needed (with a
waitUntil(Particle.syncTimeDone) and a
waitFor(Time.isValid,10000) for good measures).
My only idea of what’s happening is that if the device is not connected to the Particle cloud for a given period of time and asks for the current time the cloud cannot provide fast enough the correct time and so provides an erroneous one (maybe -1 or something similar and 944006400 is actually hard coded in the Particle’s firmware), whilst instead if the device was already connected then the cloud is “ready” for the time request. I’m not sure, its the only explanation that comes to mind for such peculiar behavior (again if the device was online say one minute prior I can guarantee that if you power it up it’ll get the correct time right away).
I’ve successfully solved the issue so I’m not asking for help in that regard, what I’m asking is your opinion on the matter (what’s going on? why Particle’s cloud exhibits such a peculiar behavior?) and what most intrigues me is the actual erroneous date, December 1, 1999 0:00:00 , I would understand if the wrong date was the epoch starting time ( January 1, 1970 0:00:00 ) but it isn’t , so I’m curious, do you have any knowledge what this date actually means?
Thanks in advance