summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-03-06 01:34:27 (GMT)
committerGitHub <noreply@github.com>2021-03-06 01:34:27 (GMT)
commite12a9e2f62bea8ddc755e373f17adfbb2740b0b1 (patch)
tree77b8c32a0f472c6ee1576a17cda5f9fe2ca9c33e
parent213c155a460b8dd9e43901e4d61aa088cbac4221 (diff)
downloadcpython-e12a9e2f62bea8ddc755e373f17adfbb2740b0b1.zip
cpython-e12a9e2f62bea8ddc755e373f17adfbb2740b0b1.tar.gz
cpython-e12a9e2f62bea8ddc755e373f17adfbb2740b0b1.tar.bz2
bpo-43407: Clarify comparisons of time.monotonic() et al results (GH-24757)
Previous wording implied that only the result of call N and N+1 could be meaningfully compared, whereas comparing call N and N+M is fine. (cherry picked from commit ff5f05934db241dfafc604989b2de3487b09ca82) Co-authored-by: Alex Willmer <alex@moreati.org.uk>
-rw-r--r--Doc/library/time.rst8
-rw-r--r--Misc/NEWS.d/next/Documentation/2021-03-04-22-53-03.bpo-43407.x570l5.rst4
2 files changed, 8 insertions, 4 deletions
diff --git a/Doc/library/time.rst b/Doc/library/time.rst
index 6842e90..e8bb9cc 100644
--- a/Doc/library/time.rst
+++ b/Doc/library/time.rst
@@ -271,7 +271,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.
.. versionadded:: 3.3
.. versionchanged:: 3.5
@@ -293,7 +293,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.
.. versionadded:: 3.3
@@ -315,7 +315,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.
.. versionadded:: 3.3
@@ -593,7 +593,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.
.. availability:: Windows, Linux, Unix systems supporting
``CLOCK_THREAD_CPUTIME_ID``.
diff --git a/Misc/NEWS.d/next/Documentation/2021-03-04-22-53-03.bpo-43407.x570l5.rst b/Misc/NEWS.d/next/Documentation/2021-03-04-22-53-03.bpo-43407.x570l5.rst
new file mode 100644
index 0000000..615e3d0
--- /dev/null
+++ b/Misc/NEWS.d/next/Documentation/2021-03-04-22-53-03.bpo-43407.x570l5.rst
@@ -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.