Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update the doc
  • Loading branch information
vstinner committed Sep 24, 2021
commit d51965779fdf64b1f34fb9854b3dcaf52eae19e7
16 changes: 9 additions & 7 deletions Doc/library/time.rst
Original file line number Diff line number Diff line change
Expand Up @@ -364,16 +364,18 @@ Functions
threads ready to run, the function returns immediately, and the thread
continues execution.

Implementation:
Unix implementation:

* On Unix, ``clock_nanosleep()`` is used if available (resolution: 1 ns),
or ``select()`` is used otherwise (resolution: 1 us).
* On Windows, a waitable timer is used (resolution: 100 ns). If *secs* is
zero, ``Sleep(0)`` is used.
* Use ``clock_nanosleep()`` if available (resolution: 1 ns);
* Or use ``nanosleep()`` if available (resolution: 1 ns);
* Or use ``select()`` (resolution: 1 us).

On Windows, a waitable timer is used (resolution: 100 ns). If *secs* is
zero, ``Sleep(0)`` is used.

.. versionchanged:: 3.11
On Unix, the ``clock_nanosleep()`` function is now used if available.
On Windows, a waitable timer is now used.
On Unix, the ``clock_nanosleep()`` and ``nanosleep()`` functions are now
used if available. On Windows, a waitable timer is now used.

.. versionchanged:: 3.5
The function now sleeps at least *secs* even if the sleep is interrupted
Expand Down
7 changes: 4 additions & 3 deletions Doc/whatsnew/3.11.rst
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,10 @@ sqlite3
time
----

* On Unix, :func:`time.sleep` now uses the ``clock_nanosleep()`` function, if
available, which has a resolution of 1 ns (10^-6 sec), rather than using
``select()`` which has a resolution of 1 us (10^-9 sec).
* On Unix, :func:`time.sleep` now uses the ``clock_nanosleep()`` or
``nanosleep()`` function, if available, which has a resolution of 1 ns (10^-6
sec), rather than using ``select()`` which has a resolution of 1 us (10^-9
sec).
(Contributed by Livius and Victor Stinner in :issue:`21302`.)

* On Windows, :func:`time.sleep` now uses a waitable timer which has a
Expand Down