]> granicus.if.org Git - php/commitdiff
@- Fixed 'O' and 'r' flags of date() to have correct sign for timezone
authorAndrei Zmievski <andrei@php.net>
Thu, 18 Jan 2001 14:36:43 +0000 (14:36 +0000)
committerAndrei Zmievski <andrei@php.net>
Thu, 18 Jan 2001 14:36:43 +0000 (14:36 +0000)
@  offset. (Andrei)

ext/standard/datetime.c

index dfb83e04bac7c641e73bb488e9db6bb628c48871..630ebb8958a8dbcdcc22176e1d338ece1e45caad 100644 (file)
@@ -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)
                                );