derick          Sun Nov 20 15:31:49 2005 EDT

  Modified files:              
    /php-src/ext/standard       microtime.c 
    /php-src/ext/date   php_date.c php_date.h 
    /php-src/ext/date/tests     bug34304.phpt bug35143.phpt 
                                date_create-2.phpt date_create-3.phpt 
                                date_modify-1.phpt date_modify-2.phpt 
  Log:
  - MF51: Fixed bug #35143 (gettimeofday() ignores current time zone).
  - MF51: Fixed tests due to class constants patch.
  
  
http://cvs.php.net/diff.php/php-src/ext/standard/microtime.c?r1=1.53&r2=1.54&ty=u
Index: php-src/ext/standard/microtime.c
diff -u php-src/ext/standard/microtime.c:1.53 
php-src/ext/standard/microtime.c:1.54
--- php-src/ext/standard/microtime.c:1.53       Wed Aug  3 10:08:09 2005
+++ php-src/ext/standard/microtime.c    Sun Nov 20 15:31:48 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: microtime.c,v 1.53 2005/08/03 14:08:09 sniper Exp $ */
+/* $Id: microtime.c,v 1.54 2005/11/20 20:31:48 derick Exp $ */
 
 #include "php.h"
 
@@ -43,6 +43,7 @@
 #include <errno.h>
 
 #include "microtime.h"
+#include "ext/date/php_date.h"
 
 #define NUL  '\0'
 #define MICRO_IN_SEC 1000000.00
@@ -68,15 +69,18 @@
        }
 
        if (mode) {
+               timelib_time_offset *offset;
+
+               offset = timelib_get_time_zone_info(tp.tv_sec, 
get_timezone_info(TSRMLS_C));
+                               
                array_init(return_value);
                add_assoc_long(return_value, "sec", tp.tv_sec);
                add_assoc_long(return_value, "usec", tp.tv_usec);
-#ifdef PHP_WIN32
-               add_assoc_long(return_value, "minuteswest", 
tz.tz_minuteswest/SEC_IN_MIN);
-#else
-               add_assoc_long(return_value, "minuteswest", tz.tz_minuteswest);
-#endif                 
-               add_assoc_long(return_value, "dsttime", tz.tz_dsttime);
+
+               add_assoc_long(return_value, "minuteswest", -offset->offset / 
SEC_IN_MIN);
+               add_assoc_long(return_value, "dsttime", offset->is_dst);
+
+               timelib_time_offset_dtor(offset);
        } else {
                char ret[100];
 
http://cvs.php.net/diff.php/php-src/ext/date/php_date.c?r1=1.67&r2=1.68&ty=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.67 php-src/ext/date/php_date.c:1.68
--- php-src/ext/date/php_date.c:1.67    Thu Nov 17 16:07:26 2005
+++ php-src/ext/date/php_date.c Sun Nov 20 15:31:48 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_date.c,v 1.67 2005/11/17 21:07:26 iliaa Exp $ */
+/* $Id: php_date.c,v 1.68 2005/11/20 20:31:48 derick Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -365,7 +365,7 @@
        return "UTC";
 }
 
-static timelib_tzinfo *get_timezone_info(TSRMLS_D)
+PHPAPI timelib_tzinfo *get_timezone_info(TSRMLS_D)
 {
        char *tz;
        timelib_tzinfo *tzi;
http://cvs.php.net/diff.php/php-src/ext/date/php_date.h?r1=1.22&r2=1.23&ty=u
Index: php-src/ext/date/php_date.h
diff -u php-src/ext/date/php_date.h:1.22 php-src/ext/date/php_date.h:1.23
--- php-src/ext/date/php_date.h:1.22    Wed Oct  5 14:38:30 2005
+++ php-src/ext/date/php_date.h Sun Nov 20 15:31:48 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_date.h,v 1.22 2005/10/05 18:38:30 derick Exp $ */
+/* $Id: php_date.h,v 1.23 2005/11/20 20:31:48 derick Exp $ */
 
 #ifndef PHP_DATE_H
 #define PHP_DATE_H
@@ -100,5 +100,6 @@
 
 /* Mechanism to set new TZ database */
 PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb);
+PHPAPI timelib_tzinfo *get_timezone_info(TSRMLS_D);
 
 #endif /* PHP_DATE_H */
http://cvs.php.net/diff.php/php-src/ext/date/tests/bug34304.phpt?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/date/tests/bug34304.phpt
diff -u /dev/null php-src/ext/date/tests/bug34304.phpt:1.2
--- /dev/null   Sun Nov 20 15:31:49 2005
+++ php-src/ext/date/tests/bug34304.phpt        Sun Nov 20 15:31:49 2005
@@ -0,0 +1,11 @@
+--TEST--
+Bug #34304 ()
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+echo date('o\-\WW\-N', strtotime('2 January 2005')), "\n";
+echo date('o\-\WW\-N', strtotime('9 January 2005')), "\n";
+?>
+--EXPECT--
+2004-W53-7
+2005-W01-7
http://cvs.php.net/diff.php/php-src/ext/date/tests/bug35143.phpt?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/date/tests/bug35143.phpt
diff -u /dev/null php-src/ext/date/tests/bug35143.phpt:1.2
--- /dev/null   Sun Nov 20 15:31:49 2005
+++ php-src/ext/date/tests/bug35143.phpt        Sun Nov 20 15:31:49 2005
@@ -0,0 +1,21 @@
+--TEST--
+Bug #35143 (gettimeofday() ignores current time zone)
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+var_dump(date_default_timezone_get());
+var_dump(gettimeofday());
+?>
+--EXPECTF--
+string(3) "UTC"
+array(4) {
+  ["sec"]=>
+  int(%d)
+  ["usec"]=>
+  int(%d)
+  ["minuteswest"]=>
+  int(0)
+  ["dsttime"]=>
+  int(0)
+}
http://cvs.php.net/diff.php/php-src/ext/date/tests/date_create-2.phpt?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/date/tests/date_create-2.phpt
diff -u php-src/ext/date/tests/date_create-2.phpt:1.1 
php-src/ext/date/tests/date_create-2.phpt:1.2
--- php-src/ext/date/tests/date_create-2.phpt:1.1       Wed Jul 20 04:31:02 2005
+++ php-src/ext/date/tests/date_create-2.phpt   Sun Nov 20 15:31:49 2005
@@ -6,7 +6,7 @@
 <?php
 date_default_timezone_set("GMT");
 $d = date_create("2005-07-18 22:10:00 +0400");
-echo $d->format(DATE_RFC822), "\n";
+echo $d->format(date::RFC822), "\n";
 ?>
 --EXPECT--
 Mon, 18 Jul 2005 22:10:00 GMT+0400
http://cvs.php.net/diff.php/php-src/ext/date/tests/date_create-3.phpt?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/date/tests/date_create-3.phpt
diff -u php-src/ext/date/tests/date_create-3.phpt:1.1 
php-src/ext/date/tests/date_create-3.phpt:1.2
--- php-src/ext/date/tests/date_create-3.phpt:1.1       Tue Aug  9 17:07:54 2005
+++ php-src/ext/date/tests/date_create-3.phpt   Sun Nov 20 15:31:49 2005
@@ -1,5 +1,7 @@
 --TEST--
 date_create() function [3]
+--SKIPIF--
+<?php if (!function_exists('date_create')) echo "SKIP"; ?>
 --FILE--
 <?php
 date_default_timezone_set("GMT");
http://cvs.php.net/diff.php/php-src/ext/date/tests/date_modify-1.phpt?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/date/tests/date_modify-1.phpt
diff -u php-src/ext/date/tests/date_modify-1.phpt:1.1 
php-src/ext/date/tests/date_modify-1.phpt:1.2
--- php-src/ext/date/tests/date_modify-1.phpt:1.1       Wed Jul 20 04:31:02 2005
+++ php-src/ext/date/tests/date_modify-1.phpt   Sun Nov 20 15:31:49 2005
@@ -6,20 +6,20 @@
 <?php
 date_default_timezone_set("Pacific/Kwajalein");
 $ts = date_create("Thu Aug 19 1993 23:59:59");
-echo date_format($ts, DATE_RFC822), "\n";
+echo date_format($ts, date::RFC822), "\n";
 $ts->modify("+1 second");
-echo date_format($ts, DATE_RFC822), "\n";
+echo date_format($ts, date::RFC822), "\n";
 
 date_default_timezone_set("Europe/Amsterdam");
 $ts = date_create("Sun Mar 27 01:59:59 2005");
-echo date_format($ts, DATE_RFC822), "\n";
+echo date_format($ts, date::RFC822), "\n";
 $ts->modify("+1 second");
-echo date_format($ts, DATE_RFC822), "\n";
+echo date_format($ts, date::RFC822), "\n";
 
 $ts = date_create("Sun Oct 30 01:59:59 2005");
-echo date_format($ts, DATE_RFC822), "\n";
+echo date_format($ts, date::RFC822), "\n";
 $ts->modify("+ 1 hour 1 second");
-echo date_format($ts, DATE_RFC822), "\n";
+echo date_format($ts, date::RFC822), "\n";
 ?>
 --EXPECT--
 Thu, 19 Aug 1993 23:59:59 KWAT
http://cvs.php.net/diff.php/php-src/ext/date/tests/date_modify-2.phpt?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/date/tests/date_modify-2.phpt
diff -u php-src/ext/date/tests/date_modify-2.phpt:1.1 
php-src/ext/date/tests/date_modify-2.phpt:1.2
--- php-src/ext/date/tests/date_modify-2.phpt:1.1       Wed Jul 20 04:31:02 2005
+++ php-src/ext/date/tests/date_modify-2.phpt   Sun Nov 20 15:31:49 2005
@@ -6,9 +6,9 @@
 <?php
 date_default_timezone_set("GMT");
 $d = date_create("2005-07-18 22:10:00 +0400");
-echo date_format($d, DATE_RFC822), "\n";
+echo date_format($d, date::RFC822), "\n";
 date_modify($d, "+1 hour");
-echo date_format($d, DATE_RFC822), "\n";
+echo date_format($d, date::RFC822), "\n";
 ?>
 --EXPECT--
 Mon, 18 Jul 2005 22:10:00 GMT+0400

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

Reply via email to