ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-cvs
php-cvs
[PHP-CVS] cvs: php-src /ext/date TODO php_date.c php_date.h /ext/date/tests default-timezone-1.phpt default-timezone-2.phpt
by Derick Rethans other posts by this author
Jun 18 2005 1:23PM messages near this date
[PHP-CVS] cvs: php-src(PHP_5_0) /build shtool | [PHP-CVS] cvs: php-src / NEWS /ext/date TODO
derick		Sat Jun 18 16:23:19 2005 EDT

  Added files:                 
    /php-src/ext/date/tests	default-timezone-1.phpt 
                           	default-timezone-2.phpt 

  Modified files:              
    /php-src/ext/date	TODO php_date.c php_date.h 
  Log:
  - Allow default timezone to be set with the .ini setting "date.timezone".
  
  
http://cvs.php.net/diff.php/php-src/ext/date/TODO?r1=1.4&r2=1.5&ty=u
Index: php-src/ext/date/TODO
diff -u php-src/ext/date/TODO:1.4 php-src/ext/date/TODO:1.5
--- php-src/ext/date/TODO:1.4	Sat Jun 18 15:40:31 2005
+++ php-src/ext/date/TODO	Sat Jun 18 16:23:18 2005
@@ -1,5 +1,3 @@
-- Implement INI setting default timezone, for now the env var "TZ" can be
-  used.
 - Port over my 200 test cases to .phpt format.
 - Write an error handler for unexpected characters while parsing dates.
 - Remove old parsedate.* code from ext/standard 
http://cvs.php.net/diff.php/php-src/ext/date/php_date.c?r1=1.10&r2=1.11&ty=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.10 php-src/ext/date/php_date.c:1.11
--- php-src/ext/date/php_date.c:1.10	Fri Jun 17 10:53:56 2005
+++ php-src/ext/date/php_date.c	Sat Jun 18 16:23:18 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_date.c,v 1.10 2005/06/17 14:53:56 derick Exp $ */
+/* $Id: php_date.c,v 1.11 2005/06/18 20:23:18 derick Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -33,8 +33,10 @@
 	{NULL, NULL, NULL}
 };
 
+ZEND_DECLARE_MODULE_GLOBALS(date)
+
 PHP_INI_BEGIN()
-/*	STD_PHP_INI_ENTRY("date.timezone", TIMEZONE_DB_LOCATION, PHP_INI_ALL, OnUpdateString, ti
mezonedb_location, zend_date_globals, date_globals) */
+	STD_PHP_INI_ENTRY("date.timezone", "GMT", PHP_INI_ALL, OnUpdateString, default_timezone, z
end_date_globals, date_globals)
 PHP_INI_END()
 
 
@@ -51,10 +53,17 @@
 	STANDARD_MODULE_PROPERTIES
 };
 
+/* {{{ php_date_init_globals */
+static void php_date_init_globals(zend_date_globals *date_globals)
+{
+	date_globals-> default_timezone = NULL;
+}
+/* }}} */
 
 
 PHP_MINIT_FUNCTION(date)
 {
+	ZEND_INIT_MODULE_GLOBALS(date, php_date_init_globals, NULL);
 	REGISTER_INI_ENTRIES();
 
 	return SUCCESS;
@@ -84,6 +93,9 @@
 	if (env) {
 		return env;
 	}
+	if (DATEG(default_timezone)) {
+		return DATEG(default_timezone);
+	}
 	/* Check config setting */
 	/*
 	 */
http://cvs.php.net/diff.php/php-src/ext/date/php_date.h?r1=1.3&r2=1.4&ty=u
Index: php-src/ext/date/php_date.h
diff -u php-src/ext/date/php_date.h:1.3 php-src/ext/date/php_date.h:1.4
--- php-src/ext/date/php_date.h:1.3	Fri Jun 17 10:53:56 2005
+++ php-src/ext/date/php_date.h	Sat Jun 18 16:23:18 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_date.h,v 1.3 2005/06/17 14:53:56 derick Exp $ */
+/* $Id: php_date.h,v 1.4 2005/06/18 20:23:18 derick Exp $ */
 
 #ifndef PHP_DATE_H
 #define PHP_DATE_H
@@ -30,5 +30,14 @@
 PHP_MSHUTDOWN_FUNCTION(date);
 PHP_MINFO_FUNCTION(date);
 
+ZEND_BEGIN_MODULE_GLOBALS(date)
+	char *default_timezone;
+ZEND_END_MODULE_GLOBALS(date)
+
+#ifdef ZTS
+#define DATEG(v) TSRMG(date_globals_id, zend_date_globals *, v)
+#else
+#define DATEG(v) (date_globals.v)
+#endif
 
 #endif /* PHP_DATE_H */

http://cvs.php.net/co.php/php-src/ext/date/tests/default-timezone-1.phpt?r=1.1&p=1
Index: php-src/ext/date/tests/default-timezone-1.phpt
+++ php-src/ext/date/tests/default-timezone-1.phpt
--TEST--
date.timezone setting [1]
--INI--
date.timezone=GMT
--FILE--
<?php
	echo strtotime("2005-06-18 22:15:44");
?> 
--EXPECT--
1119132944

http://cvs.php.net/co.php/php-src/ext/date/tests/default-timezone-2.phpt?r=1.1&p=1
Index: php-src/ext/date/tests/default-timezone-2.phpt
+++ php-src/ext/date/tests/default-timezone-2.phpt
--TEST--
date.timezone setting [2]
--INI--
date.timezone=Europe/Oslo
--FILE--
<?php
	echo strtotime("2005-06-18 22:15:44");
?> 
--EXPECT--
1119125744

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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved