[Python-Dev] PEP 418: Add monotonic clock (original) (raw)
Zooko Wilcox-O'Hearn zooko at zooko.com
Tue Mar 27 04:26:23 CEST 2012
- Previous message: [Python-Dev] PEP 418: Add monotonic clock
- Next message: [Python-Dev] PEP 418: Add monotonic clock
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
systemclock = wall clock time monotonicclock = always goes forward but can be adjusted steadyclock = always goes forward and cannot be adjusted highresolutionclock = steadyclock || systemclock
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.
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
- Previous message: [Python-Dev] PEP 418: Add monotonic clock
- Next message: [Python-Dev] PEP 418: Add monotonic clock
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]