[Python-Dev] PEP 418 is too divisive and confusing and should be postponed

Victor Stinner victor.stinner at gmail.com
Sun Apr 8 00:24:16 CEST 2012


2012/4/7 Steven D'Aprano <steve at pearwood.info>:
> Victor Stinner wrote:
>>
>> 2012/4/7 Janzert <janzert at janzert.com>:
>>>
>>> On 4/5/2012 6:32 AM, Victor Stinner wrote:
>>>>
>>>> I prefer to use CLOCK_MONOTONIC, not because it is also available for
>>>> older Linux kernels, but because it is more reliable. Even if the
>>>> underlying clock source is unstable (unstable frequency), a delta of
>>>> two reads of the CLOCK_MONOTONIC clock is a result in *seconds*,
>>>> whereas CLOCK_MONOTONIC_RAW may use an unit a little bit bigger or
>>>> smaller than a second. time.monotonic() unit is the second, as written
>>>> in its documentation.
>>>
>>> I believe the above is only true for sufficiently large time deltas. One
>>> of
>>> the major purposes of NTP slewing is to give up some short term accuracy
>>> in
>>> order to achieve long term accuracy (e.g. whenever the clock is found to
>>> be
>>> ahead of real time it is purposefully ticked slower than real time).
>>
>> I don't think that NTP works like that. NTP only uses very smooth
>> adjustements:
>>
>> ""slewing": change the clock frequency to be slightly faster or slower
>> (which is done with adjtime()). Since the slew rate is limited to 0.5
>> ms/s, each second of adjustment requires an amortization interval of
>> 2000 s. Thus, an adjustment of many seconds can take hours or days to
>> amortize."
>> http://www.python.org/dev/peps/pep-0418/#ntp-adjustment
>

> That is incorrect. NTP by default will only slew the clock for small
> discrepancies. For large discrepancies, it will step the clock, causing the
> time to jump. By default, "large" here means more than 128 milliseconds.
>
> Yes, milliseconds.
>
> http://www.ntp.org/ntpfaq/NTP-s-config-tricks.htm#AEN4249

We are talking about CLOCK_MONOTONIC. Steping is disabled on this clock.

Victor


More information about the Python-Dev mailing list