summaryrefslogtreecommitdiffhomepage
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)
*: 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 @@
#endif
static time_t read_rtc(const char **pp_rtcname, struct timeval *sys_tv, int utc)
{
- struct tm tm;
+ struct tm tm_time;
int fd;
fd = rtc_xopen(pp_rtcname, O_RDONLY);
- rtc_read_tm(&tm, fd);
+ rtc_read_tm(&tm_time, fd);
#if SHOW_HWCLOCK_DIFF
{
- int before = tm.tm_sec;
+ int before = tm_time.tm_sec;
while (1) {
- rtc_read_tm(&tm, fd);
+ rtc_read_tm(&tm_time, fd);
gettimeofday(sys_tv, NULL);
- if (before != tm.tm_sec)
+ if (before != tm_time.tm_sec)
break;
}
}
@@ -59,7 +59,7 @@ static time_t read_rtc(const char **pp_rtcname, struct timeval *sys_tv, int utc)
if (ENABLE_FEATURE_CLEAN_UP)
close(fd);
- return rtc_tm2time(&tm, utc);
+ return rtc_tm2time(&tm_time, utc);
}
static void show_clock(const char **pp_rtcname, int utc)
@@ -110,7 +110,7 @@ static void to_sys_clock(const char **pp_rtcname, int utc)
static void from_sys_clock(const char **pp_rtcname, int utc)
{
#define TWEAK_USEC 200
- struct tm tm;
+ struct tm tm_time;
struct timeval tv;
unsigned adj = TWEAK_USEC;
int rtc = rtc_xopen(pp_rtcname, O_WRONLY);
@@ -132,10 +132,10 @@ static void from_sys_clock(const char **pp_rtcname, int utc)
/* Prepare tm */
if (utc)
- gmtime_r(&t, &tm); /* may read /etc/xxx (it takes time) */
+ gmtime_r(&t, &tm_time); /* may read /etc/xxx (it takes time) */
else
- localtime_r(&t, &tm); /* same */
- tm.tm_isdst = 0;
+ localtime_r(&t, &tm_time); /* same */
+ tm_time.tm_isdst = 0;
/* gmtime/localtime took some time, re-get cur time */
gettimeofday(&tv, NULL);
@@ -166,7 +166,7 @@ static void from_sys_clock(const char **pp_rtcname, int utc)
usleep(rem_usec - adj);
}
- xioctl(rtc, RTC_SET_TIME, &tm);
+ xioctl(rtc, RTC_SET_TIME, &tm_time);
/* Debug aid to find "good" TWEAK_USEC.
* 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)
// create dir entry for volume_label
struct msdos_dir_entry *de;
#if 0
- struct tm tm;
+ struct tm tm_time;
uint16_t t, d;
#endif
de = (void*)buf;
strncpy(de->name, volume_label, sizeof(de->name));
STORE_LE(de->attr, ATTR_VOLUME);
#if 0
- localtime_r(&create_time, &tm);
- t = (tm.tm_sec >> 1) + (tm.tm_min << 5) + (tm.tm_hour << 11);
- d = tm.tm_mday + ((tm.tm_mon+1) << 5) + ((tm.tm_year-80) << 9);
+ localtime_r(&create_time, &tm_time);
+ t = (tm_time.tm_sec >> 1) + (tm_time.tm_min << 5) + (tm_time.tm_hour << 11);
+ d = tm_time.tm_mday + ((tm_time.tm_mon+1) << 5) + ((tm_time.tm_year-80) << 9);
STORE_LE(de->time, t);
STORE_LE(de->date, d);
//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)
static NOINLINE void setup_alarm(int fd, time_t *wakeup, time_t rtc_time)
{
- struct tm *tm;
+ struct tm *ptm;
struct linux_rtc_wkalrm wake;
/* 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)
* Else mode is local so the time given to the RTC
* will instead use the local time zone.
*/
- tm = localtime(wakeup);
-
- wake.time.tm_sec = tm->tm_sec;
- wake.time.tm_min = tm->tm_min;
- wake.time.tm_hour = tm->tm_hour;
- wake.time.tm_mday = tm->tm_mday;
- wake.time.tm_mon = tm->tm_mon;
- wake.time.tm_year = tm->tm_year;
+ ptm = localtime(wakeup);
+
+ wake.time.tm_sec = ptm->tm_sec;
+ wake.time.tm_min = ptm->tm_min;
+ wake.time.tm_hour = ptm->tm_hour;
+ wake.time.tm_mday = ptm->tm_mday;
+ wake.time.tm_mon = ptm->tm_mon;
+ wake.time.tm_year = ptm->tm_year;
/* wday, yday, and isdst fields are unused by Linux */
wake.time.tm_wday = -1;
wake.time.tm_yday = -1;
@@ -161,9 +161,9 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv)
/* relative or absolute alarm time, normalized to time_t */
sys_time = time(NULL);
{
- struct tm tm;
- rtc_read_tm(&tm, fd);
- rtc_time = rtc_tm2time(&tm, utc);
+ struct tm tm_time;
+ rtc_read_tm(&tm_time, fd);
+ rtc_time = rtc_tm2time(&tm_time, utc);
}