aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-01-09 19:10:49 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-01-09 19:10:49 +0100
commitdc698bb038756a926aaa529bda1b939eab2c1676 (patch)
tree4084a40897d9d81816228935a1398e80dd4b173b /util-linux
parent0681137972dc89b5003b0415e09184c0ecf1c875 (diff)
downloadbusybox-w32-dc698bb038756a926aaa529bda1b939eab2c1676.tar.gz
busybox-w32-dc698bb038756a926aaa529bda1b939eab2c1676.tar.bz2
busybox-w32-dc698bb038756a926aaa529bda1b939eab2c1676.zip
*: make it easier to distinquish "struct tm", pointer to one, etc
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/hwclock.c22
-rw-r--r--util-linux/mkfs_vfat.c8
-rw-r--r--util-linux/rtcwake.c24
3 files changed, 27 insertions, 27 deletions
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c
index ac89d45a2..b8300570e 100644
--- a/util-linux/hwclock.c
+++ b/util-linux/hwclock.c
@@ -37,20 +37,20 @@
37#endif 37#endif
38static time_t read_rtc(const char **pp_rtcname, struct timeval *sys_tv, int utc) 38static time_t read_rtc(const char **pp_rtcname, struct timeval *sys_tv, int utc)
39{ 39{
40 struct tm tm; 40 struct tm tm_time;
41 int fd; 41 int fd;
42 42
43 fd = rtc_xopen(pp_rtcname, O_RDONLY); 43 fd = rtc_xopen(pp_rtcname, O_RDONLY);
44 44
45 rtc_read_tm(&tm, fd); 45 rtc_read_tm(&tm_time, fd);
46 46
47#if SHOW_HWCLOCK_DIFF 47#if SHOW_HWCLOCK_DIFF
48 { 48 {
49 int before = tm.tm_sec; 49 int before = tm_time.tm_sec;
50 while (1) { 50 while (1) {
51 rtc_read_tm(&tm, fd); 51 rtc_read_tm(&tm_time, fd);
52 gettimeofday(sys_tv, NULL); 52 gettimeofday(sys_tv, NULL);
53 if (before != tm.tm_sec) 53 if (before != tm_time.tm_sec)
54 break; 54 break;
55 } 55 }
56 } 56 }
@@ -59,7 +59,7 @@ static time_t read_rtc(const char **pp_rtcname, struct timeval *sys_tv, int utc)
59 if (ENABLE_FEATURE_CLEAN_UP) 59 if (ENABLE_FEATURE_CLEAN_UP)
60 close(fd); 60 close(fd);
61 61
62 return rtc_tm2time(&tm, utc); 62 return rtc_tm2time(&tm_time, utc);
63} 63}
64 64
65static void show_clock(const char **pp_rtcname, int utc) 65static void show_clock(const char **pp_rtcname, int utc)
@@ -110,7 +110,7 @@ static void to_sys_clock(const char **pp_rtcname, int utc)
110static void from_sys_clock(const char **pp_rtcname, int utc) 110static void from_sys_clock(const char **pp_rtcname, int utc)
111{ 111{
112#define TWEAK_USEC 200 112#define TWEAK_USEC 200
113 struct tm tm; 113 struct tm tm_time;
114 struct timeval tv; 114 struct timeval tv;
115 unsigned adj = TWEAK_USEC; 115 unsigned adj = TWEAK_USEC;
116 int rtc = rtc_xopen(pp_rtcname, O_WRONLY); 116 int rtc = rtc_xopen(pp_rtcname, O_WRONLY);
@@ -132,10 +132,10 @@ static void from_sys_clock(const char **pp_rtcname, int utc)
132 132
133 /* Prepare tm */ 133 /* Prepare tm */
134 if (utc) 134 if (utc)
135 gmtime_r(&t, &tm); /* may read /etc/xxx (it takes time) */ 135 gmtime_r(&t, &tm_time); /* may read /etc/xxx (it takes time) */
136 else 136 else
137 localtime_r(&t, &tm); /* same */ 137 localtime_r(&t, &tm_time); /* same */
138 tm.tm_isdst = 0; 138 tm_time.tm_isdst = 0;
139 139
140 /* gmtime/localtime took some time, re-get cur time */ 140 /* gmtime/localtime took some time, re-get cur time */
141 gettimeofday(&tv, NULL); 141 gettimeofday(&tv, NULL);
@@ -166,7 +166,7 @@ static void from_sys_clock(const char **pp_rtcname, int utc)
166 usleep(rem_usec - adj); 166 usleep(rem_usec - adj);
167 } 167 }
168 168
169 xioctl(rtc, RTC_SET_TIME, &tm); 169 xioctl(rtc, RTC_SET_TIME, &tm_time);
170 170
171 /* Debug aid to find "good" TWEAK_USEC. 171 /* Debug aid to find "good" TWEAK_USEC.
172 * Look for a value which makes tv_usec close to 999999 or 0. 172 * Look for a value which makes tv_usec close to 999999 or 0.
diff --git a/util-linux/mkfs_vfat.c b/util-linux/mkfs_vfat.c
index e794b3145..54c068d0b 100644
--- a/util-linux/mkfs_vfat.c
+++ b/util-linux/mkfs_vfat.c
@@ -538,16 +538,16 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
538 // create dir entry for volume_label 538 // create dir entry for volume_label
539 struct msdos_dir_entry *de; 539 struct msdos_dir_entry *de;
540#if 0 540#if 0
541 struct tm tm; 541 struct tm tm_time;
542 uint16_t t, d; 542 uint16_t t, d;
543#endif 543#endif
544 de = (void*)buf; 544 de = (void*)buf;
545 strncpy(de->name, volume_label, sizeof(de->name)); 545 strncpy(de->name, volume_label, sizeof(de->name));
546 STORE_LE(de->attr, ATTR_VOLUME); 546 STORE_LE(de->attr, ATTR_VOLUME);
547#if 0 547#if 0
548 localtime_r(&create_time, &tm); 548 localtime_r(&create_time, &tm_time);
549 t = (tm.tm_sec >> 1) + (tm.tm_min << 5) + (tm.tm_hour << 11); 549 t = (tm_time.tm_sec >> 1) + (tm_time.tm_min << 5) + (tm_time.tm_hour << 11);
550 d = tm.tm_mday + ((tm.tm_mon+1) << 5) + ((tm.tm_year-80) << 9); 550 d = tm_time.tm_mday + ((tm_time.tm_mon+1) << 5) + ((tm_time.tm_year-80) << 9);
551 STORE_LE(de->time, t); 551 STORE_LE(de->time, t);
552 STORE_LE(de->date, d); 552 STORE_LE(de->date, d);
553 //STORE_LE(de->ctime_cs, 0); 553 //STORE_LE(de->ctime_cs, 0);
diff --git a/util-linux/rtcwake.c b/util-linux/rtcwake.c
index 64c3e7ed7..66b08e343 100644
--- a/util-linux/rtcwake.c
+++ b/util-linux/rtcwake.c
@@ -50,7 +50,7 @@ static NOINLINE bool may_wakeup(const char *rtcname)
50 50
51static NOINLINE void setup_alarm(int fd, time_t *wakeup, time_t rtc_time) 51static NOINLINE void setup_alarm(int fd, time_t *wakeup, time_t rtc_time)
52{ 52{
53 struct tm *tm; 53 struct tm *ptm;
54 struct linux_rtc_wkalrm wake; 54 struct linux_rtc_wkalrm wake;
55 55
56 /* The wakeup time is in POSIX time (more or less UTC). 56 /* The wakeup time is in POSIX time (more or less UTC).
@@ -63,14 +63,14 @@ static NOINLINE void setup_alarm(int fd, time_t *wakeup, time_t rtc_time)
63 * Else mode is local so the time given to the RTC 63 * Else mode is local so the time given to the RTC
64 * will instead use the local time zone. 64 * will instead use the local time zone.
65 */ 65 */
66 tm = localtime(wakeup); 66 ptm = localtime(wakeup);
67 67
68 wake.time.tm_sec = tm->tm_sec; 68 wake.time.tm_sec = ptm->tm_sec;
69 wake.time.tm_min = tm->tm_min; 69 wake.time.tm_min = ptm->tm_min;
70 wake.time.tm_hour = tm->tm_hour; 70 wake.time.tm_hour = ptm->tm_hour;
71 wake.time.tm_mday = tm->tm_mday; 71 wake.time.tm_mday = ptm->tm_mday;
72 wake.time.tm_mon = tm->tm_mon; 72 wake.time.tm_mon = ptm->tm_mon;
73 wake.time.tm_year = tm->tm_year; 73 wake.time.tm_year = ptm->tm_year;
74 /* wday, yday, and isdst fields are unused by Linux */ 74 /* wday, yday, and isdst fields are unused by Linux */
75 wake.time.tm_wday = -1; 75 wake.time.tm_wday = -1;
76 wake.time.tm_yday = -1; 76 wake.time.tm_yday = -1;
@@ -161,9 +161,9 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv)
161 /* relative or absolute alarm time, normalized to time_t */ 161 /* relative or absolute alarm time, normalized to time_t */
162 sys_time = time(NULL); 162 sys_time = time(NULL);
163 { 163 {
164 struct tm tm; 164 struct tm tm_time;
165 rtc_read_tm(&tm, fd); 165 rtc_read_tm(&tm_time, fd);
166 rtc_time = rtc_tm2time(&tm, utc); 166 rtc_time = rtc_tm2time(&tm_time, utc);
167 } 167 }
168 168
169 169