]> granicus.if.org Git - php/commitdiff
Fix/workaround for http://bugs.php.net/27533
authorRasmus Lerdorf <rasmus@php.net>
Fri, 12 Mar 2004 17:29:52 +0000 (17:29 +0000)
committerRasmus Lerdorf <rasmus@php.net>
Fri, 12 Mar 2004 17:29:52 +0000 (17:29 +0000)
ext/standard/datetime.c

index 82b06fb6d127304b0fe068f5719cc53f350448df..63f127d23b0c9bb0b03e5ead4547e2596357ba7b 100644 (file)
@@ -189,8 +189,14 @@ void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm)
                /* fall-through */ 
        case 1: /* hour */
                val = (*arguments[0])->value.lval; 
-               if (val < 1) { 
-                       chgsecs += (1-val) * 60*60; val = 1; 
+               /*
+                  We don't use 1 here to work around problems in some mktime implementations
+                  when it comes to daylight savings time.  Setting it to 2 and working back from
+                  there with the chgsecs offset makes us immune to these problems.
+                  See http://bugs.php.net/27533 for more info.
+               */
+               if (val < 2) { 
+                       chgsecs += (2-val) * 60*60; val = 2; 
                } 
                ta->tm_hour = val; 
                /* fall-through */