hwclock: make it report system/rtc clock difference
function old new delta
rtc_tm2time - 89 +89
read_rtc 23 86 +63
rtc_read_tm - 49 +49
hwclock_main 428 466 +38
rtcwake_main 453 477 +24
rtc_read_time 142 - -142
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 3/0 up/down: 263/-142) Total: 121 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/util-linux/rtcwake.c b/util-linux/rtcwake.c
index 049f699..64c3e7e 100644
--- a/util-linux/rtcwake.c
+++ b/util-linux/rtcwake.c
@@ -160,7 +160,12 @@
/* relative or absolute alarm time, normalized to time_t */
sys_time = time(NULL);
- rtc_time = rtc_read_time(fd, utc);
+ {
+ struct tm tm;
+ rtc_read_tm(&tm, fd);
+ rtc_time = rtc_tm2time(&tm, utc);
+ }
+
if (alarm_time) {
if (alarm_time < sys_time)