time.monotonic() roll over

Akira Li 4kir4.1i at gmail.com
Thu Dec 4 15:24:38 EST 2014


Ian Kelly <ian.g.kelly at gmail.com> writes:

> On Thu, Dec 4, 2014 at 11:09 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
>>
>> Chris Angelico <rosuav at gmail.com>:
>>
>> > It's not a Python issue. Python can't do anything more than ask the
>> > system, and if the system's value rolls over several times a year,
>> > Python can't magically cure that. The information has already been
>> > lost.
>>
>> Sure it could by having an invisible background thread occasionally call
>> time.monotonic(). It could even be done on the side without a thread.
>>
>> Anyway, the idea of a clock is complicated:
>>
>>  * the program could be stopped by a STOP signal
>>
>>  * the program could be suspended from power management
>>
>>  * the program could be resurrected from a virtual machine snapshot
>>
>>  * the program could be migrated from a different physical machine
>
> This seems like a lot of effort to unreliably design around a problem that
> will matter to only a tiny fraction of users.

- people's computers are mostly on batteries (laptops, tablets,
  smartphones) -- "suspended from power management" use case
- corporations's computations are mostly virtualized -- possible
  "ressurected", "migrated" use case

i.e., the opposite might be true -- non-virtualized PCs connected to AC
are (becoming) minority.


--
Akira




More information about the Python-list mailing list