diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-09 21:10:49 +0300 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-09 21:10:49 +0300 |
commit | dc698bb038756a926aaa529bda1b939eab2c1676 (patch) | |
tree | 4084a40897d9d81816228935a1398e80dd4b173b /coreutils | |
parent | 0681137972dc89b5003b0415e09184c0ecf1c875 (diff) |
*: make it easier to distinquish "struct tm", pointer to one, etc
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/cal.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/coreutils/cal.c b/coreutils/cal.c index 823644226..e6f9af937 100644 --- a/coreutils/cal.c +++ b/coreutils/cal.c @@ -79,7 +79,6 @@ static char *build_row(char *p, unsigned *dp); int cal_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int cal_main(int argc UNUSED_PARAM, char **argv) { - struct tm *local_time; struct tm zero_tm; time_t now; unsigned month, year, flags, i; @@ -94,11 +93,13 @@ int cal_main(int argc UNUSED_PARAM, char **argv) argv += optind; if (!argv[0]) { + struct tm *ptm; + time(&now); - local_time = localtime(&now); - year = local_time->tm_year + 1900; + ptm = localtime(&now); + year = ptm->tm_year + 1900; if (!(flags & 2)) { /* no -y */ - month = local_time->tm_mon + 1; + month = ptm->tm_mon + 1; } } else { if (argv[1]) { |