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

Replace usage of time.time() with time.monotonic() for duration calcu… #457

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

mynhardtburger
Copy link
Member

@mynhardtburger mynhardtburger commented Oct 4, 2024

Description

Replace usage of time.time() with time.monotonic() for duration calculations.

time.monotonic() is not affected by system clock updates (eg. due to NTP or daylight savings adjustments) resulting in a more reliable duration calculation.

time.perf_counter() was not used since alog is not a performance benchmarking focussed library.

…lations

Signed-off-by: Mynhardt Burger <Mynhardt.Burger@ibm.com>
@mynhardtburger mynhardtburger marked this pull request as ready for review October 4, 2024 19:41
@mynhardtburger
Copy link
Member Author

@gabe-l-hart A small PR to use the appropriate time for the ScopedTimer and ContextTimer.

Copy link
Collaborator

@gabe-l-hart gabe-l-hart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this improvement Mynhardt!

@gabe-l-hart gabe-l-hart merged commit 87e71d7 into IBM:main Oct 4, 2024
14 checks passed
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

Successfully merging this pull request may close these issues.

2 participants