On 6 April 2012 11:12, Steven D'Aprano <st...@pearwood.info> wrote:

> Glyph Lefkowitz wrote:
>
>> On Apr 5, 2012, at 8:07 PM, Zooko Wilcox-O'Hearn wrote:
>>
>
>  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.
>>>
>>
>> All clocks run at a rate approximating the rate of real time.  That is
>> very
>> close to the definition of the word "clock" in this context.  All clocks
>> have flaws in that approximation, and really those flaws are the whole
>> point of access to distinct clock APIs.  Different applications can cope
>> with different flaws.
>>
>
> I think that this is incorrect.
>
> py> time.clock(); time.sleep(10); time.clock()
> 0.41
> 0.41
>

Blame Python's use of CPU time in clock() on Unix for that. On Windows:

>>> time.clock(); time.sleep(10); time.clock()
14.879754156329385
24.879591008462793

That''s a backward compatibility issue, though - I'd be arguing that
time.clock() is the best name for "normally the right clock for interval,
benchmark or timeout uses as long as you don't care about oddities like
suspend" otherwise. Given that this name is taken, I'd argue for
time.wallclock. I'm not familiar enough with the terminology to know what
to expect from terms like monotonic, steady, raw and the like.

Paul.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to