From 4ea7ba79c5b039a0a043ef4d84ac9165745927e6 Mon Sep 17 00:00:00 2001 From: Andrei Zmievski Date: Thu, 18 Jan 2001 14:36:43 +0000 Subject: [PATCH] @- Fixed 'O' and 'r' flags of date() to have correct sign for timezone @ offset. (Andrei) --- ext/standard/datetime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) ); -- 2.40.0