-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
time-util: cleanups #2542
time-util: cleanups #2542
Conversation
a6218cc
to
84aeb5f
Compare
@keszybz Thank you for feedback. I've updated commit. |
The dual_timestamp_from_realtime(), dual_timestamp_from_monotonic() and dual_timestamp_from_boottime_or_monotonic() shares the same code for comparison given ts with delta. Let's move it to the separate inline function to prevent code duplication.
@poettering I've updated PR. What do you think about this variant? I've changed |
@0xAX @poettering Is it OK of not handling |
@benjarobin In what case? |
@0xAX Currently none... But since this function is in |
@benjarobin is right, we should make sure that USEC_INFINITY doesn't degrade to non-infinity when we subtract from it. I figure this is a lesson in that we better should have tests to catch corner-cases like this... Will prep a fix... |
PR #2564 contains a fix that makes sure that USEC_INFINITY doesn't degrade in usec_sub(), and also adds a set of tests for this. |
We have similar code in the
dual_timestamp_from_realtime()
,dual_timestamp_from_monotonic()
anddual_timestamp_from_boottime_or_monotonic()
functions which compares ats
with the given delta and returnts
depends ondelta
value. Move this code to the separate inline function to prevent code duplication.