Message388133
I believe the documentation for time.monotonic() and time.perf_counter() could be misleading. Taken literally they could imply that given
delta = 0.1
a = time.monotonic()
b = time.monotonic()
c = time.monotonic()
the comparisons `b - a < delta`, and `c - b < delta` are valid; but `c - a < delta` is not valid.
I believe that `c - a < delta` is a valid comparison, and that what the documentation means to say is "only the difference between the results of *subsequent* calls is valid."
The exact wording (present since the functions were added in https://hg.python.org/cpython/rev/376ce937823c)
> The reference point of the returned value is undefined, so that only
> the difference between the results of consecutive calls is valid.
If there is agreement I'll submit a PR. |
|
Date |
User |
Action |
Args |
2021-03-04 22:21:10 | Alex.Willmer | set | recipients:
+ Alex.Willmer, docs@python |
2021-03-04 22:21:10 | Alex.Willmer | set | messageid: <1614896470.36.0.766208602401.issue43407@roundup.psfhosted.org> |
2021-03-04 22:21:10 | Alex.Willmer | link | issue43407 messages |
2021-03-04 22:21:10 | Alex.Willmer | create | |
|