diff options
Diffstat (limited to 'util-linux/hwclock.c')
-rw-r--r-- | util-linux/hwclock.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c index 3d28364e9..2cdb186c5 100644 --- a/util-linux/hwclock.c +++ b/util-linux/hwclock.c | |||
@@ -36,7 +36,10 @@ static void write_rtc(time_t t, int utc) | |||
36 | struct tm tm; | 36 | struct tm tm; |
37 | int rtc = rtc_xopen(&rtcname, O_WRONLY); | 37 | int rtc = rtc_xopen(&rtcname, O_WRONLY); |
38 | 38 | ||
39 | tm = *(utc ? gmtime(&t) : localtime(&t)); | 39 | if (utc) |
40 | gmtime_r(&t, &tm); | ||
41 | else | ||
42 | localtime_r(&t, &tm); | ||
40 | tm.tm_isdst = 0; | 43 | tm.tm_isdst = 0; |
41 | 44 | ||
42 | xioctl(rtc, RTC_SET_TIME, &tm); | 45 | xioctl(rtc, RTC_SET_TIME, &tm); |