How often does time sync with the cloud?


In the documentation it says:

“The device synchronizes time with the Particle Cloud during the handshake. From then, the time is continually updated on the device.”

I want to make sure I understand this correctly. I take this to mean that the Electron time syncs with the cloud during the handshake, and that this uses some small amount of data. From there you can use your time functions without using any data. When they say that " time is continually updated on the device" does that mean that it re-syncs on some regular or semi-regular basis? If so - how often? And how much data does it use when it does?



Hi @spork

I think you have to call Particle.syncTime() yourself periodically.


Interesting. I guess the part about time being continually updated on the device simply means that the Electron keeps time internally? I think I actually prefer that. I can call sync once/day or so.



Both the Photon and the Electron have real-time clock (RTC) sections in their processors and time is kept there. The VBAT pin or connection even allows that to keep running when powered down (but on Electron VBAT is wired to +3.3V since Electron already requires a battery).

The RTCs do not keep perfect time in my experience drifting 20-30 seconds per day for some of my devices. You can choose to sync when you need to and once a day seems fine.


You mean if you are manually managing your connection to the internet (particularly Electron)? Otherwise, I have clocks using Photon (permanent WiFi connection) which never make such a call and stay within a couple of seconds (as best as I can tell) accuracy.


Hi @BulldogLowell

I think the time is set whenever the cloud connection is initialized (and then whenever you call Particle.syncTime). I could not find anything in the firmware that called any of the many time-related functions on a schedule.

That said, if your Photons are taking long sleeps and then reconnecting to the cloud, that could be helping you. Or you could just have better than average crystals on your devices.


According to the docs, syncTime is called whenever the device connects to the cloud. In my testing, I have noticed that my devices disconnect from and reconnect to the cloud multiple times per day (with the reconnect usually taking about 7 seconds). I’m not sure why this happens, and I’m still doing some testing to investigate. This happens even on a device that’s running nothing but my connection logging code. If your devices are behaving similarly, this could explain your good accuracy.


I never get that lucky…

That’s my kind of luck!