aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-01-06 22:43:39 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-01-06 22:43:39 +0100
commit5e3b14069e3fe25ec2595124e6e0103c7be4f813 (patch)
treed818305a88168d4aff500e2dc9a5fb590763375a /libbb
parent695fa51c80047eb25cc82e6e1630b4545a6bc0b6 (diff)
downloadbusybox-w32-5e3b14069e3fe25ec2595124e6e0103c7be4f813.tar.gz
busybox-w32-5e3b14069e3fe25ec2595124e6e0103c7be4f813.tar.bz2
busybox-w32-5e3b14069e3fe25ec2595124e6e0103c7be4f813.zip
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>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/rtc.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/libbb/rtc.c b/libbb/rtc.c
index 2f38b8a7e..9807e1cf9 100644
--- a/libbb/rtc.c
+++ b/libbb/rtc.c
@@ -59,15 +59,17 @@ int FAST_FUNC rtc_xopen(const char **default_rtc, int flags)
59 return xopen(*default_rtc, flags); 59 return xopen(*default_rtc, flags);
60} 60}
61 61
62time_t FAST_FUNC rtc_read_time(int fd, int utc) 62void FAST_FUNC rtc_read_tm(struct tm *tm, int fd)
63{ 63{
64 struct tm tm; 64 memset(tm, 0, sizeof(*tm));
65 char *oldtz = 0; 65 xioctl(fd, RTC_RD_TIME, tm);
66 time_t t = 0; 66 tm->tm_isdst = -1; /* "not known" */
67}
67 68
68 memset(&tm, 0, sizeof(struct tm)); 69time_t FAST_FUNC rtc_tm2time(struct tm *tm, int utc)
69 xioctl(fd, RTC_RD_TIME, &tm); 70{
70 tm.tm_isdst = -1; /* not known */ 71 char *oldtz = oldtz; /* for compiler */
72 time_t t;
71 73
72 if (utc) { 74 if (utc) {
73 oldtz = getenv("TZ"); 75 oldtz = getenv("TZ");
@@ -75,7 +77,7 @@ time_t FAST_FUNC rtc_read_time(int fd, int utc)
75 tzset(); 77 tzset();
76 } 78 }
77 79
78 t = mktime(&tm); 80 t = mktime(tm);
79 81
80 if (utc) { 82 if (utc) {
81 unsetenv("TZ"); 83 unsetenv("TZ");