Author vstinner
Recipients akira, shankarunni, vstinner, yselivanov
Date 2014-04-26.23:59:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
If you want to modify time.sleep(), you must be careful of the portability: Windows, Linux, but also Mac OS X, FreeBSD, Solaris, etc.

Try to describe the behaviour of each underlying C function on each platform to be able to describe the "portable behaviour" on all platforms, especially the expected behaviour when the system clock is changed (is time.sleep impacted or not? always?) and the expected behaviour when the system is suspended.

For example, it looks like nanosleep() uses a different clock depending on OS (Linux uses CLOCK_MONOTONIC, other UNIX platforms use CLOCK_REALTIME).

I know that you suggest to use clock_nanosleep(), but this function is not available on all platforms. For example, I would not use it on Windows.

Another example (on Fedora?): "sleep() ignores time spent with a suspended system"

You should also decide how to handle interrupted sleep (C error "EINTR"). Currently, the sleep is interrupted, no error is raised.

I began to describe all these functions in the PEP 418, even if I didn't change the implementation with the PEP:
Date User Action Args
2014-04-26 23:59:46vstinnersetrecipients: + vstinner, akira, yselivanov, shankarunni
2014-04-26 23:59:46vstinnersetmessageid: <>
2014-04-26 23:59:46vstinnerlinkissue21302 messages
2014-04-26 23:59:44vstinnercreate