rasmus          Fri Mar 12 12:27:55 2004 EDT

  Modified files:              (Branch: PHP_4_3)
    /php-src/ext/standard       datetime.c 
  Log:
  Fix/workaround for http://bugs.php.net/27533
  
  
http://cvs.php.net/diff.php/php-src/ext/standard/datetime.c?r1=1.96.2.11&r2=1.96.2.12&ty=u
Index: php-src/ext/standard/datetime.c
diff -u php-src/ext/standard/datetime.c:1.96.2.11 
php-src/ext/standard/datetime.c:1.96.2.12
--- php-src/ext/standard/datetime.c:1.96.2.11   Wed Feb 11 20:32:40 2004
+++ php-src/ext/standard/datetime.c     Fri Mar 12 12:27:55 2004
@@ -19,7 +19,7 @@
  */
 
 
-/* $Id: datetime.c,v 1.96.2.11 2004/02/12 01:32:40 sniper Exp $ */
+/* $Id: datetime.c,v 1.96.2.12 2004/03/12 17:27:55 rasmus Exp $ */
 
 
 #include "php.h"
@@ -161,7 +161,7 @@
                        ta->tm_year = Z_LVAL_PP(arguments[5])
                          - ((Z_LVAL_PP(arguments[5]) > 1000) ? 1900 : 0);
                /* fall-through */
-       case 5: /* day in month (1-baesd) */
+       case 5: /* day in month (1-based) */
                val = (*arguments[4])->value.lval; 
                if (val < 1) { 
                        chgsecs += (1-val) * 60*60*24; 
@@ -192,8 +192,14 @@
                /* 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 */ 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to