-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-126745: Fixup Docu time.rst #126744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-126745: Fixup Docu time.rst #126744
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -299,6 +299,11 @@ Functions | |||||||||
Use :func:`monotonic_ns` to avoid the precision loss caused by the | ||||||||||
:class:`float` type. | ||||||||||
|
||||||||||
10000 .. 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,13 +312,21 @@ 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` | ||||||||||
This comment was marked as resolved.
Sorry, something went wrong. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
now call ``QueryPerformanceCounter()`` which has a resolution of 1 microsecond, | ||||||||||
Comment on lines
+316
to
+317
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
instead of the ``GetTickCount64()`` clock like in previous versions, which has | ||||||||||
a resolution of 15.625 milliseconds. | ||||||||||
|
||||||||||
.. function:: monotonic_ns() -> int | ||||||||||
|
||||||||||
Similar to :func:`monotonic`, but return time as nanoseconds. | ||||||||||
|
||||||||||
.. 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 | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Suspect the mixed indentation is screwing it up |
||||||||||
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 | ||||||||||
|
||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes more sense under perf_counter were it was. All monotonic function should always be monotonic, by definition.