time.monotonic() roll over

ast nomail at invalid.com
Thu Dec 4 10:25:44 EST 2014


Hello,

Does any body know when time.monotonic() rolls over ?

On python doc https://docs.python.org/3/library/time.html
it is said  every 49.7 days on Windows versions older than 
Vista. For more recent Windows, it is sais that  monotonic() 
is system-wide but they dont say anything about roll over,
probably it hasn't changed.

Anyway, if someone need a monotonic clock, he may think
to use either time.time() or time.monotonic().
There is no roll over problem with time.time() since the very
first one in planned far in the future, but time.time() can go
backward when a date update throught NTP server is done.

time.monotonic() is monotonic but roll over often (every 49.7 
days)

So what to do ? 

Using time.monotonic() and take some actions if a roll over 
is detected ?



More information about the Python-list mailing list