(original) (raw)



On Thu, Apr 5, 2012 at 6:34 AM, Victor Stinner <victor.stinner@gmail.com> wrote:

2012/4/5 PJ Eby <pje@telecommunity.com>:

>> More details why it's hard to define such function and why I dropped
>> it from the PEP.
>>
>> If someone wants to propose again such function ("monotonic or
>> fallback to system" clock), two issues should be solved:
>>
>> �- name of the function
>> �- description of the function
>
> Maybe I missed it, but did anyone ever give a reason why the fallback
> couldn't be to Steven D'Aprano's monotonic wrapper algorithm over the system
> clock?� (Given a suitable minimum delta.)� That function appeared to me to
> provide a sufficiently monotonic clock for timeout purposes, if nothing
> else.


Did you read the following section of the PEP?
http://www.python.org/dev/peps/pep-0418/#working-around-operating-system-bugs

Did I miss something? If yes, could you write a patch for the PEP please?

What's missing is that if you're using a monotonic clock for timeouts, then a monotonically-adjusted system clock can do that, subject to the polling frequency -- it does not break just because the system clock is set backwards; it simply loses time proportional to the frequency with which it is polled.

For timeout purposes in a single process, such a clock is useful. �It just isn't suitable for benchmarks, or for interprocess coordination.