Skip to content

gh-115637 clarify that time.perf_counter cannot go backwards #115638

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anarcat
Copy link

@anarcat anarcat commented Feb 18, 2024

I'm not completely sure about this, but it seems to me this counter is also designed to avoid jumping backwards on (say) daylight saving or clock changes. It's kind of hinted to in the current description, but reading PEP 418 it's very clear that it's part of the intention, as it falls back to time.monotonic() apart from on nt.


📚 Documentation preview 📚: https://cpython-previews--115638.org.readthedocs.build/

@ghost
Copy link

ghost commented Feb 18, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

I'm not completely sure about this, but it seems to me this counter is *also* designed to avoid jumping backwards on (say) daylight saving or clock changes. It's kind of hinted to in the current description, but reading PEP 418 it's very clear that it's part of the intention, as it falls back to time.monotonic() apart from on `nt`.
@anarcat anarcat marked this pull request as draft February 19, 2024 14:31
@willingc
Copy link
Contributor

@arnarcat Thanks for the draft PR. Given your discussion with @vstinner on the issue, do you want to move this out of draft or close the PR?

@anarcat
Copy link
Author

anarcat commented Feb 24, 2024

i'm not sure. i guess i'm waiting on other folks to weigh in on the issue first...

@vstinner
Copy link
Member

See also issue gh-88494.

I created PR gh-116781 to use QueryPerformanceCounter() for time.monotonic().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

3 participants