cvs: /php3/functions parsedate.y

From: Date: Mon, 12 Jul 1999 15:53:56 +0000
Subject: cvs: /php3/functions parsedate.y
Groups: php.dev 
Request: Send a blank email to php-dev+get-8414@lists.php.net to get a copy of this message
andrey Mon Jul 12 15:53:56 1999 EDT Modified files: /php3/functions parsedate.y Log: Let's make them static and rearrange. Index: php3/functions/parsedate.y diff -u php3/functions/parsedate.y:1.3 php3/functions/parsedate.y:1.4 --- php3/functions/parsedate.y:1.3 Mon Jul 12 15:23:33 1999 +++ php3/functions/parsedate.y Mon Jul 12 15:53:56 1999 @@ -219,13 +219,28 @@ #endif #endif -time_t +static time_t +timeconv(hh, mm, ss, mer) +register int hh, mm, ss, mer; +{ + if (mm < 0 || mm > 59 || ss < 0 || ss > 59) return (-1); + switch (mer) { + case AM: if (hh < 1 || hh > 12) return(-1); + return (60L * ((hh%12)*60L + mm)+ss); + case PM: if (hh < 1 || hh > 12) return(-1); + return (60L * ((hh%12 +12)*60L + mm)+ss); + case 24: if (hh < 0 || hh > 23) return (-1); + return (60L * (hh*60L + mm)+ss); + default: return (-1); + } +} + +static time_t dateconv(mm, dd, yy, h, m, s, mer, zone, dayflag) int mm, dd, yy, h, m, s, mer, zone, dayflag; { time_t tod, jdate; register int i; - time_t timeconv(); if (yy < 0) yy = -yy; if (yy < 70) yy += 2000; @@ -244,14 +259,24 @@ jdate += -1*60*60; return (jdate); } + +static time_t +daylcorr(future, now) +time_t future, now; +{ + int fdayl, nowdayl; + + nowdayl = (localtime(&now)->tm_hour+1) % 24; + fdayl = (localtime(&future)->tm_hour+1) % 24; + return (future-now) + 60L*60L*(nowdayl-fdayl); +} -time_t +static time_t dayconv(ord, day, now) int ord, day; time_t now; { register struct tm *loctime; time_t tod; - time_t daylcorr(); tod = now; loctime = localtime(&tod); @@ -260,22 +285,7 @@ return daylcorr(tod, now); } -time_t -timeconv(hh, mm, ss, mer) -register int hh, mm, ss, mer; -{ - if (mm < 0 || mm > 59 || ss < 0 || ss > 59) return (-1); - switch (mer) { - case AM: if (hh < 1 || hh > 12) return(-1); - return (60L * ((hh%12)*60L + mm)+ss); - case PM: if (hh < 1 || hh > 12) return(-1); - return (60L * ((hh%12 +12)*60L + mm)+ss); - case 24: if (hh < 0 || hh > 23) return (-1); - return (60L * (hh*60L + mm)+ss); - default: return (-1); - } -} -time_t +static time_t monthadd(sdate, relmonth) time_t sdate, relmonth; { @@ -292,19 +302,8 @@ return daylcorr(dateconv(mm, ltime->tm_mday, yy, ltime->tm_hour, ltime->tm_min, ltime->tm_sec, 24, ourzone, MAYBE), sdate); } - -time_t -daylcorr(future, now) -time_t future, now; -{ - int fdayl, nowdayl; - - nowdayl = (localtime(&now)->tm_hour+1) % 24; - fdayl = (localtime(&future)->tm_hour+1) % 24; - return (future-now) + 60L*60L*(nowdayl-fdayl); -} -int lookup(char *id) +static int lookup(char *id) { #define gotit (yylval=i->value, i->type) extern int yylval; @@ -374,7 +373,7 @@ static char *lptr; -int yylex() +static int yylex() { extern int yylval; int sign = 0; @@ -547,7 +546,6 @@ struct timeval *now; { #define mcheck(f) if (f>1) err++ - time_t monthadd(); int err; struct tm *lt; struct timeval ftz;

« previous php.dev (#8414) next »