When does Playdate check the network to update the clock?

I notice the Playdate clock runs a little fast until it checks and corrects that. Which doesn't seem to happen on restarting the device/exiting an app.

When does the time-checking happen? Is it the same as checking for downloads—20 minutes after sleep? EDIT: no, letting it sleep for :20+ doesn't seem to update the clock accuracy.

(Sometimes it also seems to update the time when I connect it to my computer—am I imagining that?)

From a glance at the code, it appears to sync time when connecting to wi-fi, if it notices that there's been significant drift OR if it's been more than 5 days since the last sync. I don't think it triggers a sync when connecting via USB.

You should be able to force a sync by toggling "Set Automatically" off and on (under Settings > Time).

1 Like

Cool—I know my Playtime users will ask, now I know!

I wonder, what is significant drift? Mine has drifted about 30 seconds (fast) in a day or two. (Usually I'd see 10 seconds or so in that time.)

I might post a feature request to tighten the threshold to maybe 5 or 10 seconds drift.

For posterity: connecting a computer via USB Disk Mode (including when sending an app from Simulator) does update the clock accuracy--just tried it again.

Maybe that's an indirect effect—maybe WiFi disconnects and reconnects for USB Disk Mode?

(It doesn't seem to reconnect WiFi when Restarting the Playdate—since that did not correct the time.)

It doesn't look for drift specifically; it tries resyncing when there's an SSL error and it can't tell what the precise cause was. I'm not sure how big the sync window is (and it can vary among servers) but it's probably on the order of minutes, not seconds.

Yeah, I don't see it explicitly in the code, but there could be some side effect like that that triggers it.

Got it. Then I'll put in a feature request to call for a time update manually. Thanks!

Oops--one last question: will it only do the 5-day check while asleep?

After 5 days pass, it will sync time the next time it connects to check for new games and OS updates (while locked or otherwise).

1 Like

Got it! That's a schedule I already understand I think. Thank you