From: Andrei Zmievski Date: Thu, 18 Jan 2001 14:36:43 +0000 (+0000) Subject: @- Fixed 'O' and 'r' flags of date() to have correct sign for timezone X-Git-Tag: php-4.0.5RC1~532 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4ea7ba79c5b039a0a043ef4d84ac9165745927e6;p=php @- Fixed 'O' and 'r' flags of date() to have correct sign for timezone @ offset. (Andrei) --- diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c index dfb83e04ba..630ebb8958 100644 --- a/ext/standard/datetime.c +++ b/ext/standard/datetime.c @@ -433,7 +433,7 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm) #if HAVE_TM_GMTOFF sprintf(tmp_buff, "%c%02d%02d", (ta->tm_gmtoff < 0) ? '-' : '+', abs(ta->tm_gmtoff / 3600), abs( ta->tm_gmtoff % 3600)); #else - sprintf(tmp_buff, "%c%02d%02d", ((ta->tm_isdst ? timezone - 3600:timezone)<0)?'-':'+',abs((ta->tm_isdst ? timezone - 3600 : timezone) / 3600), abs((ta->tm_isdst ? timezone - 3600 : timezone) % 3600)); + sprintf(tmp_buff, "%c%02d%02d", ((ta->tm_isdst ? timezone - 3600:timezone)>0)?'-':'+',abs((ta->tm_isdst ? timezone - 3600 : timezone) / 3600), abs((ta->tm_isdst ? timezone - 3600 : timezone) % 3600)); #endif strcat(return_value->value.str.val, tmp_buff); break; @@ -493,7 +493,7 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm) ta->tm_hour, ta->tm_min, ta->tm_sec, - ((ta->tm_isdst ? timezone - 3600 : timezone) < 0) ? '-' : '+', + ((ta->tm_isdst ? timezone - 3600 : timezone) > 0) ? '-' : '+', abs((ta->tm_isdst ? timezone - 3600 : timezone) / 3600), abs((ta->tm_isdst ? timezone - 3600 : timezone) % 3600) );