32 lines
988 B
Diff
32 lines
988 B
Diff
From ed23cbce644987eb41c0de3bef47ac7e7a32f03a Mon Sep 17 00:00:00 2001
|
|
From: Rosen Penev <rosenp@gmail.com>
|
|
Date: Sat, 18 Apr 2020 22:34:55 -0700
|
|
Subject: [PATCH 220/389] [clang-tidy] use ceil
|
|
|
|
Found with bugprone-incorrect-roundings
|
|
|
|
Signed-off-by: Rosen Penev <rosenp@gmail.com>
|
|
---
|
|
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 1026adc..37abab4 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"),
|
|
--
|
|
1.8.3.1
|
|
|