|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[1999-06-15 14:07 UTC] egon at tradeservices dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 08 16:00:01 2026 UTC |
in functions/datetime.c, the code for translate to GMT is broken. The (I think) fixed version would look like this: void _php3_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm) { pval *arguments[6]; struct tm ta, *tn; time_t t; int i, gmadjust=0,arg_count = ARG_COUNT(ht); if (arg_count > 6 || getParametersArray(ht, arg_count, arguments) == FAI LURE) { WRONG_PARAM_COUNT; } /* convert supplied arguments to longs */ for (i = 0; i < arg_count; i++) { convert_to_long(arguments[i]); } t=time(NULL); #if HAVE_TZSET tzset(); #endif tn = localtime(&t); memcpy(&ta,tn,sizeof(struct tm)); ta.tm_isdst = -1; switch(arg_count) { case 6: ta.tm_year = arguments[5]->value.lval - ((arguments[5]->value.lv al > 1000) ? 1900 : 0); /* fall-through */ case 5: ta.tm_mday = arguments[4]->value.lval; /* fall-through */ case 4: ta.tm_mon = arguments[3]->value.lval - 1; /* fall-through */ case 3: ta.tm_sec = arguments[2]->value.lval; /* fall-through */ case 2: ta.tm_min = arguments[1]->value.lval; /* fall-through */ case 1: ta.tm_hour = arguments[0]->value.lval/* - gmadjust*/; 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; }