derick          Mon Apr  7 17:43:49 2008 UTC

  Modified files:              
    /php-src/ext/date/lib       parse_tz.c unixtime2tm.c 
  Log:
  - Fixing returned offset.
  - Algorithm optimization.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_tz.c?r1=1.35&r2=1.36&diff_format=u
Index: php-src/ext/date/lib/parse_tz.c
diff -u php-src/ext/date/lib/parse_tz.c:1.35 
php-src/ext/date/lib/parse_tz.c:1.36
--- php-src/ext/date/lib/parse_tz.c:1.35        Mon Dec 31 07:12:08 2007
+++ php-src/ext/date/lib/parse_tz.c     Mon Apr  7 17:43:49 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: parse_tz.c,v 1.35 2007/12/31 07:12:08 sebastian Exp $ */
+/* $Id: parse_tz.c,v 1.36 2008/04/07 17:43:49 derick Exp $ */
 
 #include "timelib.h"
 
@@ -370,7 +370,7 @@
        switch (t->zone_type) {
                case TIMELIB_ZONETYPE_ABBR:
                case TIMELIB_ZONETYPE_OFFSET:
-                       return t->z * 60;
+                       return (t->z + t->dst) * -60;
                        
                case TIMELIB_ZONETYPE_ID:
                        gmt_offset = timelib_get_time_zone_info(t->sse, 
t->tz_info);
http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/unixtime2tm.c?r1=1.20&r2=1.21&diff_format=u
Index: php-src/ext/date/lib/unixtime2tm.c
diff -u php-src/ext/date/lib/unixtime2tm.c:1.20 
php-src/ext/date/lib/unixtime2tm.c:1.21
--- php-src/ext/date/lib/unixtime2tm.c:1.20     Mon Dec 31 07:12:08 2007
+++ php-src/ext/date/lib/unixtime2tm.c  Mon Apr  7 17:43:49 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: unixtime2tm.c,v 1.20 2007/12/31 07:12:08 sebastian Exp $ */
+/* $Id: unixtime2tm.c,v 1.21 2008/04/07 17:43:49 derick Exp $ */
 
 #include "timelib.h"
 
@@ -76,12 +76,18 @@
                */
 
                while (tmp_days <= 0) {
-                       cur_year--;
-                       DEBUG(printf("tmp_days=%lld, year=%lld\n", tmp_days, 
cur_year););
-                       if (timelib_is_leap(cur_year)) {
-                               tmp_days += DAYS_PER_LYEAR;
+                       if (tmp_days < -1460970) {
+                               cur_year -= 4000;
+                               DEBUG(printf("tmp_days=%lld, year=%lld\n", 
tmp_days, cur_year););
+                               tmp_days += 1460970;
                        } else {
-                               tmp_days += DAYS_PER_YEAR;
+                               cur_year--;
+                               DEBUG(printf("tmp_days=%lld, year=%lld\n", 
tmp_days, cur_year););
+                               if (timelib_is_leap(cur_year)) {
+                                       tmp_days += DAYS_PER_LYEAR;
+                               } else {
+                                       tmp_days += DAYS_PER_YEAR;
+                               }
                        }
                }
                remainder += SECS_PER_DAY;



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

Reply via email to