From ed23cbce644987eb41c0de3bef47ac7e7a32f03a Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 18 Apr 2020 22:34:55 -0700 Subject: [PATCH] [clang-tidy] use ceil Found with bugprone-incorrect-roundings Signed-off-by: Rosen Penev --- sys-utils/hwclock.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c index 1026adc23f..37abab42d6 100644 --- a/sys-utils/hwclock.c +++ b/sys-utils/hwclock.c @@ -608,9 +608,8 @@ set_hardware_clock_exact(const struct hwclock_control *ctl, } newhwtime = sethwtime - + (int)(time_diff(nowsystime, refsystime) - - delay /* don't count this */ - + 0.5 /* for rounding */); + + ceil(time_diff(nowsystime, refsystime) + - delay /* don't count this */); if (ctl->verbose) printf(_("%ld.%06ld is close enough to %ld.%06ld (%.6f < %.6f)\n" "Set RTC to %ld (%ld + %d; refsystime = %ld.%06ld)\n"), -- 2.47.3