Skip to content

bpo-43407: Docs: Clarify comparisons of time.monotonic() et al results #24757

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

Merged
merged 1 commit into from
Mar 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions Doc/library/time.rst
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ Functions
Return the value (in fractional seconds) of a monotonic clock, i.e. a clock
that cannot go backwards. The clock is not affected by system clock updates.
The reference point of the returned value is undefined, so that only the
difference between the results of consecutive calls is valid.
difference between the results of two calls is valid.

Use :func:`monotonic_ns` to avoid the precision loss caused by the
:class:`float` type.
Expand Down Expand Up @@ -306,7 +306,7 @@ Functions
clock with the highest available resolution to measure a short duration. It
does include time elapsed during sleep and is system-wide. The reference
point of the returned value is undefined, so that only the difference between
the results of consecutive calls is valid.
the results of two calls is valid.

Use :func:`perf_counter_ns` to avoid the precision loss caused by the
:class:`float` type.
Expand Down Expand Up @@ -334,7 +334,7 @@ Functions
CPU time of the current process. It does not include time elapsed during
sleep. It is process-wide by definition. The reference point of the
returned value is undefined, so that only the difference between the results
of consecutive calls is valid.
of two calls is valid.

Use :func:`process_time_ns` to avoid the precision loss caused by the
:class:`float` type.
Expand Down Expand Up @@ -626,7 +626,7 @@ Functions
CPU time of the current thread. It does not include time elapsed during
sleep. It is thread-specific by definition. The reference point of the
returned value is undefined, so that only the difference between the results
of consecutive calls in the same thread is valid.
of two calls in the same thread is valid.

Use :func:`thread_time_ns` to avoid the precision loss caused by the
:class:`float` type.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Clarified that a result from :func:`time.monotonic`,
:func:`time.perf_counter`, :func:`time.process_time`, or
:func:`time.thread_time` can be compared with the result from any following
call to the same function - not just the next immediate call.