[Python-Dev] PEP 418: Add monotonic clock
Zooko Wilcox-O'Hearn
zooko at zooko.com
Tue Mar 27 04:26:23 CEST 2012
> system_clock = wall clock time
> monotonic_clock = always goes forward but can be adjusted
> steady_clock = always goes forward and cannot be adjusted
> high_resolution_clock = steady_clock || system_clock
Note that the C++ standard deprecated monotonic_clock once they
realized that there is absolutely no point in having a clock that
jumps forward but not back, and that none of the operating systems
implement such a thing -- instead they all implement a clock which
doesn't jump in either direction.
http://stackoverflow.com/questions/6777278/what-is-the-rationale-for-renaming-monotonic-clock-to-steady-clock-in-chrono
In other words, yes! +1! The C++ standards folks just went through the
process that we're now going through, and if we do it right we'll end
up at the same place they are:
http://en.cppreference.com/w/cpp/chrono/system_clock
"""
system_clock represents the system-wide real time wall clock. It may
not be monotonic: on most systems, the system time can be adjusted at
any moment. It is the only clock that has the ability to map its time
points to C time, and, therefore, to be displayed.
steady_clock: monotonic clock that will never be adjusted
high_resolution_clock: the clock with the shortest tick period available
"""
Note that we don't really have the option of providing a clock which
is "monotonic but not steady" in the sense of "can jump forward but
not back". It is a misunderstanding (doubtless due to the confusing
name "monotonic") to think that such a thing is offered by the
underlying platforms. We can choose to *call* it "monotonic",
following POSIX instead of calling it "steady", following C++.
Regards,
Zooko
More information about the Python-Dev
mailing list