>> We're going around in circles. I'm not asking what sleep does, I want
>> on principle a timer that does the same thing as sleep(), regardless
>> of how sleep() works. So if on some OS sleep() uses the same algorithm
>> as CLOCK_MONOTONIC_RAW, I want my timer to use that too. But if on
>> some other OS sleep() uses CLOCK_MONOTONIC, I want my timer there to
>> use that. And if on some OS sleep() is buggy and uses the time-of-day
>> clock, well, I wouldn't mind if my timer used the same thing.
>
> sleep() takes a number of seconds as argument, so CLOCK_MONOTONIC
> should be used, not CLOCK_MONOTONIC_RAW. If I understood correctly,
> the unit of CLOCK_MONOTONIC is a second, whereas CLOCK_MONOTONIC_RAW
> may be faster or slower than a second.

sleep() is not affected by system clock update on any OS: I tested
Linux, FreeBSD, Mac OS X and OpenIndiana.

By the way, CLOCK_BOOTTIME was added to Linux 2.6.39: it includes time
elapsed during system suspend, whereas CLOCK_MONOTONIC doesn't include
time elapsed during system suspend. I updated the "Monotonic clocks"
table to indicate if the clock includes the elapsed time or not.
http://www.python.org/dev/peps/pep-0418/#monotonic-clocks

Victor
_______________________________________________
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