[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)
Guido van Rossum
guido at python.org
Sun Apr 8 16:29:30 CEST 2012
On Sun, Apr 8, 2012 at 3:42 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
>> | I made the same suggestion earlier but I don't know that anyone did
>> | anything with it. :-( It would be nice to know what clock sleep() uses
>> | on each of the major platforms.
>> I saw it but didn't know what I could do with it, or even if it can be
>> found out in any very general sense.
>> Looking at nanosleep(2) on a recent Linux system says:
> time.sleep() uses select(), not nanosleep().
> select() is not specified to use a particular clock. However, since it
> takes a timeout rather than a deadline, it would be reasonable for it
> to use a non-adjustable clock :-)
Still, my hope was to cut short a bunch of discussion by declaring
that on every platform, one of the timers available should match the
one used by sleep(), select() and the like -- assuming they all use
the same timer underneath in a typical OS, even though (due to
standardization at different times by different standards bodies) they
aren't all specified the same.
IOW "What's good enough for sleep() is good enough for
user-implemented timeouts and scheduling." as a way to reach at least
one decision for a platform with agreed-upon cross-platform
characteristics that are useful.
What to name it can't be decided this way, although I might put
I personally have a need for one potentially different clock -- to
measure short intervals for benchmarks and profiling. This might be
--Guido van Rossum (python.org/~guido)
More information about the Python-Dev