aboutsummaryrefslogtreecommitdiff
path: root/util-linux/hwclock.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-07-18 03:40:35 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-07-18 03:40:35 +0200
commit73b71f381d24218cf6368364be723a7b5c9aeda9 (patch)
treefe3c6e1056417bbd2dc470cd5ad74daaf25542ea /util-linux/hwclock.c
parentd23f64eba79a702c36d8d8cec23b49c320897138 (diff)
downloadbusybox-w32-73b71f381d24218cf6368364be723a7b5c9aeda9.tar.gz
busybox-w32-73b71f381d24218cf6368364be723a7b5c9aeda9.tar.bz2
busybox-w32-73b71f381d24218cf6368364be723a7b5c9aeda9.zip
date: factor out date parsing (in preparation for touch -d)
function old new delta parse_datestr - 391 +391 sha512_process_block128 1283 1310 +27 buffer_fill_and_print 179 196 +17 nexpr 826 840 +14 unzip_main 1931 1939 +8 popstring 134 140 +6 qrealloc 33 36 +3 builtin_umask 121 123 +2 evalvar 1365 1363 -2 changepath 194 192 -2 do_compress 1698 1688 -10 hwclock_main 340 329 -11 cmdputs 414 402 -12 identify 4343 4329 -14 date_main 1186 687 -499 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 7/7 up/down: 468/-550) Total: -82 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/hwclock.c')
-rw-r--r--util-linux/hwclock.c5
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);