Skip to content

Conversation

@canton7
Copy link

@canton7 canton7 commented Nov 12, 2025

'time.time()' uses the system clock, which can jump forwards and backwards, e.g. because the device syncs with a time server. 'time.monotonic()' is stable and will not jump.

My specific problem is that I have a picture frame which powers on every so often, fetches another image to display, shows it, and powers off again. It doesn't keep time when powered off (so powers on with the clock in the past), then it syncs with an NTP server at some point shortly after power-on, and the clock jumps forwards. However, this often happens inside the busy polling loop, which means that the loop exits straight away with a timeout. This means that we don't want for the image to be fully displayed before returning.

'time.time()' uses the system clock, which can jump forwards and
backwards, e.g. because the device syncs with a time server.
'time.monotonic()' is stable and will not jump.

My specific problem is that I have a picture frame which powers on every
so often, fetches another image to display, shows it, and powers off
again. It doesn't keep time when powered off (so powers on with the
clock in the past), then it syncs with an NTP server at some point
shortly after power-on, and the clock jumps forwards. However, this
often happens inside the busy polling loop, which means that the loop
exits straight away with a timeout. This means that we don't want for
the image to be fully displayed before returning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant