From: tholo Date: Sat, 4 May 1996 07:43:25 +0000 (+0000) Subject: Actually declare and initialize nowtime... Oops. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=da6d40b52ddcd4b312aed4ce829a7447800a45ee;p=openbsd Actually declare and initialize nowtime... Oops. --- diff --git a/gnu/usr.bin/cvs/lib/getdate.c b/gnu/usr.bin/cvs/lib/getdate.c index a9acf1dacbc..b0f9411cabb 100644 --- a/gnu/usr.bin/cvs/lib/getdate.c +++ b/gnu/usr.bin/cvs/lib/getdate.c @@ -721,25 +721,30 @@ get_date(p, now) struct timeb ftz; time_t Start; time_t tod; + time_t nowtime; yyInput = p; if (now == NULL) { now = &ftz; - (void)time(&ftz.time); + (void)time(&nowtime); - if (! (tm = gmtime (&ftz.time))) + if (! (tm = gmtime (&nowtime))) return -1; gmt = *tm; /* Make a copy, in case localtime modifies *tm. */ - if (! (tm = localtime (&ftz.time))) + if (! (tm = localtime (&nowtime))) return -1; ftz.timezone = difftm (&gmt, tm) / 60; if(tm->tm_isdst) ftz.timezone += 60; } + else + { + nowtime = now->time; + } - tm = localtime(&now->time); + tm = localtime(&nowtime); yyYear = tm->tm_year; yyMonth = tm->tm_mon + 1; yyDay = tm->tm_mday; diff --git a/gnu/usr.bin/cvs/lib/getdate.y b/gnu/usr.bin/cvs/lib/getdate.y index f538ef4237e..57871426745 100644 --- a/gnu/usr.bin/cvs/lib/getdate.y +++ b/gnu/usr.bin/cvs/lib/getdate.y @@ -902,25 +902,30 @@ get_date(p, now) struct timeb ftz; time_t Start; time_t tod; + time_t nowtime; yyInput = p; if (now == NULL) { now = &ftz; - (void)time(&ftz.time); + (void)time (&nowtime); - if (! (tm = gmtime (&ftz.time))) + if (! (tm = gmtime (&nowtime))) return -1; gmt = *tm; /* Make a copy, in case localtime modifies *tm. */ - if (! (tm = localtime (&ftz.time))) + if (! (tm = localtime (&nowtime))) return -1; ftz.timezone = difftm (&gmt, tm) / 60; if(tm->tm_isdst) ftz.timezone += 60; } + else + { + nowtime = now->time; + } - tm = localtime(&now->time); + tm = localtime(&nowtime); yyYear = tm->tm_year; yyMonth = tm->tm_mon + 1; yyDay = tm->tm_mday;