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

core: replace time.time by monotonic clock #1109

Merged
merged 1 commit into from
Oct 23, 2019
Merged

core: replace time.time by monotonic clock #1109

merged 1 commit into from
Oct 23, 2019

Conversation

jd
Copy link
Contributor

@jd jd commented Oct 23, 2019

time.time might jump around as the clock changes (NTP, leap seconds, etc).
It's safer to use monotonic.monotonic to get elapsed time ranges.

@jd jd requested a review from a team as a code owner October 23, 2019 13:38
ddtrace/utils/time.py Outdated Show resolved Hide resolved
`time.time` might jump around as the clock changes (NTP, leap seconds, etc).
It's safer to use monotonic.monotonic to get elapsed time ranges.
@jd
Copy link
Contributor Author

jd commented Oct 23, 2019

I've settled and removed the reset() method since it's not used nor tested. :p

Copy link
Member

@brettlangdon brettlangdon left a comment

Choose a reason for hiding this comment

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

lgtm, there are probably other places we can use this, but this works for now 👍

@jd
Copy link
Contributor Author

jd commented Oct 23, 2019

I actually looked and did not find any (I've exlcuded the tests though). Feel free to point me at some if you know them, I'll PR!

@brettlangdon
Copy link
Member

Oh you are right.

I was thinking about Tracer.wrap but our Span timings aren't done this way really anyways

@jd jd merged commit 3b5f837 into DataDog:master Oct 23, 2019
@jd jd deleted the monotonic branch October 23, 2019 16:26
@majorgreys majorgreys added this to the 0.31.0 milestone Oct 31, 2019
@majorgreys majorgreys changed the title Replace time.time by monotonic clock core: replace time.time by monotonic clock Oct 31, 2019
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.

None yet

3 participants