mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 16:35:06 -05:00
use round() for rounding
Replace casting of values incremented by +0.5/-0.5 with round().
This commit is contained in:
@@ -572,10 +572,7 @@ RCL_AddCookedPulse(RCL_Instance instance, struct timespec *cooked_time,
|
||||
}
|
||||
|
||||
/* Align the offset to the reference sample */
|
||||
if ((ref_sample.offset - offset) >= 0.0)
|
||||
shift = (long)((ref_sample.offset - offset) * rate + 0.5) / (double)rate;
|
||||
else
|
||||
shift = (long)((ref_sample.offset - offset) * rate - 0.5) / (double)rate;
|
||||
shift = round((ref_sample.offset - offset) * rate) / rate;
|
||||
|
||||
offset += shift;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user