From: Rosen Penev Date: Sun, 19 Apr 2020 05:34:55 +0000 (-0700) Subject: [clang-tidy] use ceil X-Git-Tag: v2.36-rc1~138^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ed23cbce644987eb41c0de3bef47ac7e7a32f03a;p=thirdparty%2Futil-linux.git [clang-tidy] use ceil Found with bugprone-incorrect-roundings Signed-off-by: Rosen Penev --- 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"),