[Python-Dev] this is why we shouldn't call it a "monotonic clock" (was: PEP 418 is too divisive and confusing and should be postponed)

Victor Stinner victor.stinner at gmail.com
Sat Apr 7 01:47:16 CEST 2012


> 2. Those who think that "monotonic clock" means a clock that never
> jumps, and that runs at a rate approximating the rate of real time.
> This is a very useful kind of clock to have! It is what C++ now calls
> a "steady clock". It is what all the major operating systems provide.

For the "C++" part, I suppose that you are thinking to:
"Objects of class steady_clock represent clocks for which values of
time_point advance at a steady rate relative to real time. That is,
the clock may not be adjusted."
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3128.html#time.clock.steady

I don't understand this definition. All clocks have a clock drift.
This is just one exception: atomic clocks, but such clocks are rare
and very expensive.

http://www.clocktypes.com/buy_atomic_clocks.html
"Atomic clocks can have a high price, but if you really want to buy
one there is at least one place you can purchase an atomic clock.

    Agilent Technologies (www.agilient.com)
    Model number 5071A atomic clock with a long-term stability better
than 1 x 10-14 price - $50,390"

There is a simple "trick" to get a very cheap steady clock: adjust the
clock manually. Extract of a Wikipedia article:
"More advanced clocks and old mechanical clocks often have some kind
of speed trimmer where one can adjust the speed of the clock and thus
reduce the clock drift. For instance, in pendulum clocks the clock
drift can be manipulated by slightly changing the length of the
pendulum."
http://en.wikipedia.org/wiki/Clock_drift

Or you can use a NTP daemon to adjust automatically using a free farm
of atomic clocks distributed around the world.

So you can get a cheap steady clock if you accept that (OMG!) it can
be adjusted.

Or did I misunderstand "the clock may not be adjusted"?

Victor


More information about the Python-Dev mailing list