Skip to content
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

Use monotonic clock to compute durations #18206

Open
rhcarvalho opened this issue Apr 10, 2020 · 2 comments
Open

Use monotonic clock to compute durations #18206

rhcarvalho opened this issue Apr 10, 2020 · 2 comments
Assignees

Comments

@rhcarvalho
Copy link
Contributor

Searching for time.time() in the code base reveals many cases where we use it to compute durations, when it would be more robust to use a monotonic clock.

On Python 3.3+ this would be time.monotonic() or time.perf_counter() (or even time.process_time()), as appropriate.

On Python 2.x and <3.3 there is https://pypi.org/project/monotonic/.

See also https://www.python.org/dev/peps/pep-0418/.

@joshuarli
Copy link
Member

Yeah, I've seen @beezz use monotonic clock in some ops code and it's good. This would maybe require a bit of care auditing all the time usage, as I'm not sure if we rely on the assumption on some deltas being >= 0, for example.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 6, 2021

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Accepted, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants