diff options
author | Karel Zak | 2019-01-14 12:04:04 +0100 |
---|---|---|
committer | Karel Zak | 2019-01-14 12:04:04 +0100 |
commit | 491f3693cbe71fd3cef3f63bb0a286ee85422456 (patch) | |
tree | ed929e688197ac51bd4b10269307b6171e1539eb /sys-utils | |
parent | Merge branch 'asan-fixes' of https://github.com/kerolasa/util-linux (diff) | |
parent | fsck.cramfs: use utimes() instead of utime() that is obsolete (diff) | |
download | kernel-qcow2-util-linux-491f3693cbe71fd3cef3f63bb0a286ee85422456.tar.gz kernel-qcow2-util-linux-491f3693cbe71fd3cef3f63bb0a286ee85422456.tar.xz kernel-qcow2-util-linux-491f3693cbe71fd3cef3f63bb0a286ee85422456.zip |
Merge branch 'time-fixes' of https://github.com/kerolasa/util-linux
* 'time-fixes' of https://github.com/kerolasa/util-linux:
fsck.cramfs: use utimes() instead of utime() that is obsolete
hwclock: use monotonic time to measure how long setting time takes
include: add indirect monotonic clock id specifier
timeutils: match today day and this year correctly
Diffstat (limited to 'sys-utils')
-rw-r--r-- | sys-utils/Makemodule.am | 4 | ||||
-rw-r--r-- | sys-utils/hwclock-rtc.c | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/sys-utils/Makemodule.am b/sys-utils/Makemodule.am index 825a7335b..fdecbfac4 100644 --- a/sys-utils/Makemodule.am +++ b/sys-utils/Makemodule.am @@ -454,7 +454,9 @@ hwclock_SOURCES = \ sys-utils/hwclock.h \ sys-utils/hwclock-cmos.c if LINUX -hwclock_SOURCES += sys-utils/hwclock-rtc.c +hwclock_SOURCES += \ + sys-utils/hwclock-rtc.c \ + lib/monotonic.c endif hwclock_LDADD = $(LDADD) libcommon.la -lm if HAVE_AUDIT diff --git a/sys-utils/hwclock-rtc.c b/sys-utils/hwclock-rtc.c index 32feb3504..a0d28f89e 100644 --- a/sys-utils/hwclock-rtc.c +++ b/sys-utils/hwclock-rtc.c @@ -12,6 +12,7 @@ #include <time.h> #include <unistd.h> +#include "monotonic.h" #include "nls.h" #include "hwclock.h" @@ -223,12 +224,12 @@ static int busywait_for_rtc_clock_tick(const struct hwclock_control *ctl, * something weird happens, we have a time limit (1.5s) on this loop * to reduce the impact of this failure. */ - gettimeofday(&begin, NULL); + gettime_monotonic(&begin); do { rc = do_rtc_read_ioctl(rtc_fd, &nowtime); if (rc || start_time.tm_sec != nowtime.tm_sec) break; - gettimeofday(&now, NULL); + gettime_monotonic(&now); if (time_diff(now, begin) > 1.5) { warnx(_("Timed out waiting for time change.")); return 1; |