diff --git a/Doc/library/time.rst b/Doc/library/time.rst index 6265c2214eaa0d..9e38d2a1355cb7 100644 --- a/Doc/library/time.rst +++ b/Doc/library/time.rst @@ -299,6 +299,11 @@ Functions Use :func:`monotonic_ns` to avoid the precision loss caused by the :class:`float` type. + .. impl-detail:: + + On CPython, use the same clock as :func:`time.perf_counter` and is a + monotonic clock, i.e. a clock that cannot go backwards. + .. versionadded:: 3.3 .. versionchanged:: 3.5 @@ -307,6 +312,11 @@ Functions .. versionchanged:: 3.10 On macOS, the function is now system-wide. + .. versionchanged:: 3.13 + Use the same clock as :func:`time.perf_counter`. On Windows, :func:`monotonic` + now call ``QueryPerformanceCounter()`` which has a resolution of 1 microsecond, + instead of the ``GetTickCount64()`` clock like in previous versions, which has + a resolution of 15.625 milliseconds. .. function:: monotonic_ns() -> int @@ -314,6 +324,9 @@ Functions .. versionadded:: 3.7 + .. versionchanged:: 3.13 + Use the same clock as :func:`time.perf_counter`. + .. function:: perf_counter() -> float .. index:: @@ -325,11 +338,6 @@ Functions point of the returned value is undefined, so that only the difference between the results of two calls is valid. - .. impl-detail:: - - On CPython, use the same clock as :func:`time.monotonic` and is a - monotonic clock, i.e. a clock that cannot go backwards. - Use :func:`perf_counter_ns` to avoid the precision loss caused by the :class:`float` type. @@ -338,10 +346,6 @@ Functions .. versionchanged:: 3.10 On Windows, the function is now system-wide. - .. versionchanged:: 3.13 - Use the same clock as :func:`time.monotonic`. - - .. function:: perf_counter_ns() -> int Similar to :func:`perf_counter`, but return time as nanoseconds. @@ -699,13 +703,18 @@ Functions Clock: - * On Windows, call ``GetSystemTimeAsFileTime()``. + * On Windows, call ``GetSystemTimePreciseAsFileTime()``. * Call ``clock_gettime(CLOCK_REALTIME)`` if available. * Otherwise, call ``gettimeofday()``. Use :func:`time_ns` to avoid the precision loss caused by the :class:`float` type. + .. versionchanged:: 3.13 + On Windows, :func:`.time` now uses the ``GetSystemTimePreciseAsFileTime()`` + clock for a resolution of 1 microsecond, instead of the + ``GetSystemTimeAsFileTime()`` clock which has a resolution of + 15.625 milliseconds. .. function:: time_ns() -> int