From dc698bb038756a926aaa529bda1b939eab2c1676 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 9 Jan 2010 19:10:49 +0100 Subject: *: make it easier to distinquish "struct tm", pointer to one, etc Signed-off-by: Denys Vlasenko --- coreutils/cal.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'coreutils') 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]) { -- cgit v1.2.3