CVS update: php3/functions

From: Date: Tue, 15 Jun 1999 12:28:25 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-6984@lists.php.net to get a copy of this message
Date: Tuesday June 15, 1999 @ 8:28 Author: rasmus Update of /repository/php3/functions In directory php:/tmp/cvs-serv28237/functions Modified Files: datetime.c Log Message: Fix gmmktime() bug Index: php3/functions/datetime.c diff -u php3/functions/datetime.c:1.60 php3/functions/datetime.c:1.61 --- php3/functions/datetime.c:1.60 Wed Jun 9 07:20:39 1999 +++ php3/functions/datetime.c Tue Jun 15 08:28:24 1999 @@ -30,7 +30,7 @@ */ -/* $Id: datetime.c,v 1.60 1999/06/09 11:20:39 kk Exp $ */ +/* $Id: datetime.c,v 1.61 1999/06/15 12:28:24 rasmus Exp $ */ #ifdef THREAD_SAFE @@ -107,13 +107,6 @@ tzset(); #endif tn = localtime(&t); - if (gm) { -#if HAVE_TM_GMTOFF - gmadjust=(tn->tm_gmtoff)/3600; -#else - gmadjust=timezone/3600; -#endif - } memcpy(&ta,tn,sizeof(struct tm)); ta.tm_isdst = -1; @@ -134,10 +127,24 @@ ta.tm_min = arguments[1]->value.lval; /* fall-through */ case 1: - ta.tm_hour = arguments[0]->value.lval - gmadjust; + ta.tm_hour = arguments[0]->value.lval; case 0: break; } + + t=mktime(&ta); /* Need to do this because of Daylight savings */ + tn = localtime(&t); + + if (gm) { +#if HAVE_TM_GMTOFF + gmadjust=(tn->tm_gmtoff)/3600; +#else + gmadjust=timezone/3600; +#endif + } + + ta.tm_hour+=gmadjust; + return_value->value.lval = mktime(&ta); return_value->type = IS_LONG; }

« previous php.dev (#6984) next »