Avoid Cloud Syncing Time

Hey,

I'm working on with an application where time is very important and I'm looking to have it synchronized across multiple devices. I would prefer to just sync time from my GPS and not have the particle setTime sync the time when the Boron connects to the cloud. I was looking for some thoughts on what might be the best way to avoid the Particle time to overwrite my time on a cloud reconnect. I appreciate any feedback. Thank you!

It is not possible. What I would do is use your own time calls that access the GNSS receiver instead of using the Particle time calls whenever you need the time. This will assure you get the correct time.

Also the built-in real-time clock isn't particularly accurate and has a 1 second resolution and may drift quite a bit, so it's best to not use it if you need precise timing.

1 Like

Hey,
Thank you for getting back with me. Would a solution look something like syncing the UNIX time from GPS to a variable and then increment that variable by a software timer, and re-syncing UNIX time every so oftern? I appreciate your insight!

That's what I was thinking, but if you don't need the increased resolution there is another way:

You can use Particle.timeSyncedLast(). If the value changes, the cloud just synchronized the time, so you should get the time from your GNSS again. The call doesn't do any cloud operations, but it does require a task switch to the system thread, so you might not want to do it on every loop call, maybe 10 times per second.

1 Like