diff options
author | Victor Stinner <vstinner@python.org> | 2021-09-22 16:09:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-22 16:09:30 +0200 |
commit | 58f8adfda3c2b42f654a55500e8e3a6433cb95f2 (patch) | |
tree | 2804e1290e728fe7f5aa6ba46215b894de3f88ea /Include/cpython | |
parent | 8620be99da930230b18ec05f4d7446ee403531af (diff) | |
download | cpython-git-58f8adfda3c2b42f654a55500e8e3a6433cb95f2.tar.gz |
bpo-21302: time.sleep() uses waitable timer on Windows (GH-28483)
On Windows, time.sleep() now uses a waitable timer which has a
resolution of 100 ns (10^-7 sec). Previously, it had a solution of 1
ms (10^-3 sec).
* On Windows, time.sleep() now calls PyErr_CheckSignals() before
resetting the SIGINT event.
* Add _PyTime_As100Nanoseconds() function.
* Complete and update time.sleep() documentation.
Co-authored-by: Livius <egyszeregy@freemail.hu>
Diffstat (limited to 'Include/cpython')
-rw-r--r-- | Include/cpython/pytime.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Include/cpython/pytime.h b/Include/cpython/pytime.h index b045388439..8c2958501f 100644 --- a/Include/cpython/pytime.h +++ b/Include/cpython/pytime.h @@ -114,6 +114,12 @@ PyAPI_FUNC(_PyTime_t) _PyTime_AsMicroseconds(_PyTime_t t, /* Convert timestamp to a number of nanoseconds (10^-9 seconds). */ PyAPI_FUNC(_PyTime_t) _PyTime_AsNanoseconds(_PyTime_t t); +#ifdef MS_WINDOWS +// Convert timestamp to a number of 100 nanoseconds (10^-7 seconds). +PyAPI_FUNC(_PyTime_t) _PyTime_As100Nanoseconds(_PyTime_t t, + _PyTime_round_t round); +#endif + /* Convert timestamp to a number of nanoseconds (10^-9 seconds) as a Python int object. */ PyAPI_FUNC(PyObject *) _PyTime_AsNanosecondsObject(_PyTime_t t); |