]> granicus.if.org Git - php/commitdiff
- Renamed date_timezone_set/get() to date_default_timezone_set/get().
authorDerick Rethans <derick@php.net>
Mon, 4 Jul 2005 21:27:26 +0000 (21:27 +0000)
committerDerick Rethans <derick@php.net>
Mon, 4 Jul 2005 21:27:26 +0000 (21:27 +0000)
- Added missing proto's and folding marks.

13 files changed:
ext/date/php_date.c
ext/date/php_date.h
ext/date/tests/bug26198.phpt
ext/date/tests/bug28599.phpt
ext/date/tests/bug29585.phpt
ext/date/tests/bug29595.phpt
ext/date/tests/bug33056.phpt
ext/date/tests/bug33452.phpt
ext/date/tests/bug33536.phpt
ext/date/tests/bug33562.phpt
ext/date/tests/bug33563.phpt
ext/date/tests/format-negative-timestamp.phpt
ext/date/tests/timezone-configuration.phpt

index 03be35cc910faa47aa7af4c54e18b26429d81ff9..9bf2ac9e27e4c97da4b58bd15a7a27b34a01a23b 100644 (file)
@@ -28,6 +28,7 @@
 #include "lib/timelib.h"
 #include <time.h>
 
+/* {{{ Function table */
 function_entry date_functions[] = {
        PHP_FE(strtotime, NULL)
        PHP_FE(date, NULL)
@@ -45,18 +46,21 @@ function_entry date_functions[] = {
        PHP_FE(localtime, NULL)
        PHP_FE(getdate, NULL)
 
-       PHP_FE(date_timezone_set, NULL)
-       PHP_FE(date_timezone_get, NULL)
+       PHP_FE(date_default_timezone_set, NULL)
+       PHP_FE(date_default_timezone_get, NULL)
        {NULL, NULL, NULL}
 };
+/* }}} */
 
 ZEND_DECLARE_MODULE_GLOBALS(date)
 
+/* {{{ INI Settings */
 PHP_INI_BEGIN()
        STD_PHP_INI_ENTRY("date.timezone", "", PHP_INI_ALL, OnUpdateString, default_timezone, zend_date_globals, date_globals)
 PHP_INI_END()
+/* }}} */
 
-
+/* {{{ Module struct */
 zend_module_entry date_module_entry = {
        STANDARD_MODULE_HEADER,
        "date",                     /* extension name */
@@ -69,6 +73,8 @@ zend_module_entry date_module_entry = {
        PHP_VERSION,                /* extension version */
        STANDARD_MODULE_PROPERTIES
 };
+/* }}} */
+
 
 /* {{{ php_date_init_globals */
 static void php_date_init_globals(zend_date_globals *date_globals)
@@ -78,6 +84,7 @@ static void php_date_init_globals(zend_date_globals *date_globals)
 }
 /* }}} */
 
+/* {{{ PHP_RINIT_FUNCTION */
 PHP_RINIT_FUNCTION(date)
 {
        if (DATEG(timezone)) {
@@ -87,7 +94,9 @@ PHP_RINIT_FUNCTION(date)
 
        return SUCCESS;
 }
+/* }}} */
 
+/* {{{ PHP_RSHUTDOWN_FUNCTION */
 PHP_RSHUTDOWN_FUNCTION(date)
 {
        if (DATEG(timezone)) {
@@ -97,7 +106,9 @@ PHP_RSHUTDOWN_FUNCTION(date)
 
        return SUCCESS;
 }
+/* }}} */
 
+/* {{{ PHP_MINIT_FUNCTION */
 PHP_MINIT_FUNCTION(date)
 {
        ZEND_INIT_MODULE_GLOBALS(date, php_date_init_globals, NULL);
@@ -105,25 +116,28 @@ PHP_MINIT_FUNCTION(date)
 
        return SUCCESS;
 }
+/* }}} */
 
-
+/* {{{ PHP_MSHUTDOWN_FUNCTION */
 PHP_MSHUTDOWN_FUNCTION(date)
 {
        UNREGISTER_INI_ENTRIES();
 
        return SUCCESS;
 }
+/* }}} */
 
-
+/* {{{ PHP_MINFO_FUNCTION */
 PHP_MINFO_FUNCTION(date)
 {
        php_info_print_table_start();
        php_info_print_table_row(2, "date/time support", "enabled");
        php_info_print_table_end();
 }
+/* }}} */
 
-/* =[ Helper functions ] ================================================== */
 
+/* {{{ Helper functions */
 static char* guess_timezone(TSRMLS_D)
 {
        char *env;
@@ -180,8 +194,10 @@ static timelib_tzinfo *get_timezone_info(TSRMLS_D)
        }
        return tzi;
 }
+/* }}} */
+
 
-/* =[ date() and gmdate() ]================================================ */
+/* {{{ date() and gmdate() data */
 #include "ext/standard/php_smart_str.h"
 
 static char *mon_full_names[] = {
@@ -215,7 +231,9 @@ static char *english_suffix(int number)
        }
        return "th";
 }
+/* }}} */
 
+/* {{{ php_format_date - (gm)date helper */
 static char *php_format_date(char *format, int format_len, timelib_time *t, int localtime)
 {
        smart_str            string = {0};
@@ -345,18 +363,26 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime)
        RETVAL_STRING(string, 0);
        timelib_time_dtor(t);
 }
+/* }}} */
 
+/* {{{ proto string date(string format [, long timestamp])
+   Format a local date/time */
 PHP_FUNCTION(date)
 {
        php_date(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
 }
+/* }}} */
 
+/* {{{ proto string gmdate(string format [, long timestamp])
+   Format a GMT date/time */
 PHP_FUNCTION(gmdate)
 {
        php_date(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
 }
+/* }}} */
 
-/* Backwards compability function */
+
+/* {{{ php_parse_date: Backwards compability function */
 signed long php_parse_date(char *string, signed long *now)
 {
        timelib_time *parsed_time;
@@ -372,6 +398,7 @@ signed long php_parse_date(char *string, signed long *now)
        }
        return retval;
 }
+/* }}} */
 
 
 /* {{{ proto int strtotime(string time, int now)
@@ -432,6 +459,8 @@ PHP_FUNCTION(strtotime)
 }
 /* }}} */
 
+
+/* {{{ php_mktime - (gm)mktime helper */
 PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
 {
        long hou, min, sec, mon, day, yea, dst = -1;
@@ -515,6 +544,7 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
                RETURN_LONG(ts);
        }
 }
+/* }}} */
 
 /* {{{ proto int mktime(int hour, int min, int sec, int mon, int day, int year)
    Get UNIX timestamp for a date */
@@ -532,6 +562,7 @@ PHP_FUNCTION(gmmktime)
 }
 /* }}} */
 
+
 /* {{{ proto bool checkdate(int month, int day, int year)
    Returns true(1) if it is a valid date in gregorian calendar */
 PHP_FUNCTION(checkdate)
@@ -550,8 +581,7 @@ PHP_FUNCTION(checkdate)
 /* }}} */
 
 #ifdef HAVE_STRFTIME
-/* {{{ php_strftime
- */
+/* {{{ php_strftime - (gm)strftime helper */
 PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
 {
        char                *format, *buf;
@@ -637,7 +667,7 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
    Format a local time/date according to locale settings */
 PHP_FUNCTION(strftime)
 {
-       _php_strftime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
+       php_strftime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
 }
 /* }}} */
 
@@ -645,7 +675,7 @@ PHP_FUNCTION(strftime)
    Format a GMT/UCT time/date according to locale settings */
 PHP_FUNCTION(gmstrftime)
 {
-       _php_strftime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
+       php_strftime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
 }
 /* }}} */
 #endif
@@ -737,7 +767,10 @@ PHP_FUNCTION(getdate)
 }
 /* }}} */
 
-PHP_FUNCTION(date_timezone_set)
+
+/* {{{ proto void date_default_timezone_set(string timezone_identifier)
+   Sets the default timezone used by all date/time functions in a script */
+PHP_FUNCTION(date_default_timezone_set)
 {
        char *zone;
        int   zone_len;
@@ -752,11 +785,15 @@ PHP_FUNCTION(date_timezone_set)
        DATEG(timezone) = estrndup(zone, zone_len);
        RETURN_TRUE;
 }
+/* }}} */
 
-PHP_FUNCTION(date_timezone_get)
+/* {{{ proto void date_default_timezone_get(string timezone_identifier)
+   Gets the default timezone used by all date/time functions in a script */
+PHP_FUNCTION(date_default_timezone_get)
 {
        RETURN_STRING(DATEG(timezone), 0);
 }
+/* }}} */
 
 /*
  * Local variables:
index 4ea7ed554cb8dd92a1309ac931643eab83f067b4..894477eda9133356bd5a392c334d88d947144dd2 100644 (file)
@@ -42,8 +42,8 @@ PHP_FUNCTION(time);
 PHP_FUNCTION(localtime);
 PHP_FUNCTION(getdate);
 
-PHP_FUNCTION(date_timezone_set);
-PHP_FUNCTION(date_timezone_get);
+PHP_FUNCTION(date_default_timezone_set);
+PHP_FUNCTION(date_default_timezone_get);
 
 PHP_RINIT_FUNCTION(date);
 PHP_RSHUTDOWN_FUNCTION(date);
index f42aed967d315d441d907fb4982230e59ab151d0..c957bfcf7a9b9f75b1c97c5e54d37f630941fec7 100644 (file)
@@ -2,7 +2,7 @@
 Bug #26198 (strtotime handling of "M Y" and "Y M" format)
 --FILE--
 <?php
-       date_timezone_set("GMT");
+       date_default_timezone_set("GMT");
        echo gmdate("F Y (Y-m-d H:i:s T)\n", strtotime("Oct 2001"));
        echo gmdate("M Y (Y-m-d H:i:s T)\n", strtotime("2001 Oct"));
 ?>
index 73da0c102f76c5ca6de2ee38810ef107d37945ca..fcd17b46972fb218a3ea2e0aabe911ded0ef887a 100644 (file)
@@ -2,7 +2,7 @@
 Bug #28599 (strtotime fails with zero base time)
 --FILE--
 <?php
-date_timezone_set("Europe/Amsterdam");
+date_default_timezone_set("Europe/Amsterdam");
 print gmdate("d-m-Y H:i:s", strtotime("+30 minutes", 1100535573));
 ?>
 --EXPECT--
index 4443efda8cd097bc12729a804f3013acffc0c15a..394569924662b7b20649800f9447917d89931822 100644 (file)
@@ -2,7 +2,7 @@
 Bug #29585 (Support week numbers in strtotime())
 --FILE--
 <?php
-date_timezone_set("GMT");
+date_default_timezone_set("GMT");
 echo gmdate("Y-m-d H:i:s", strtotime("2004W30"));
 ?>
 --EXPECT--
index 441ef97b7d9cf0c77f5db6830fd1fcdb508e8f43..285ade140b34801efdbdb3e72e8ebe58276a946f 100644 (file)
@@ -2,7 +2,7 @@
 Bug #29595 (Roman number format for months)
 --FILE--
 <?php
-date_timezone_set("GMT");
+date_default_timezone_set("GMT");
 $from_postgres = '2004-08-09 14:48:27.304809+10';
 
 echo strtotime($from_postgres);
index cd5e8c5cafb7fe3a1b79df7b6d0546f27eaacff3..441acc57124aa45d23520b00f5908729a32e16a6 100644 (file)
@@ -2,7 +2,7 @@
 Bug #33056 (strtotime() does not parse 20050518t090000Z)
 --FILE--
 <?php
-date_timezone_set("GMT");
+date_default_timezone_set("GMT");
 echo strtotime('20050518t090000Z')."\n";
 echo strtotime('20050518t091234Z')."\n";
 echo strtotime('20050518t191234Z')."\n";
index ac1395ea72202584e5077b6312e9f2d31b96294b..e5abebf3c8dd64326ebc74d631a2511064528c49 100644 (file)
@@ -2,7 +2,7 @@
 Bug #33452 (Support for year accompanying ISO week nr)
 --FILE--
 <?php
-date_timezone_set("GMT");
+date_default_timezone_set("GMT");
 echo date('Y-W', strtotime('2005-1-1')), "\n";
 echo date('o-W', strtotime('2005-1-1')), "\n";
 ?>
index 8ba6ffc2f2be2eb6217d3e56602ff144848949ba..aa5f5ddb38bfe368c212cb89f8f3501a56671e04 100644 (file)
@@ -2,7 +2,7 @@
 Bug #33456 (strtotime defaults to now even on non time string)
 --FILE--
 <?php
-date_timezone_set("GMT");
+date_default_timezone_set("GMT");
 var_dump(strtotime("monkey"));
 print date("Y-m-d", strtotime("monkey")) ."\n";
 print date("Y-m-d", false) ."\n";
index f86fce6d62267f10b898087db5d414e9cbeeaa73..8383a79ab73598c8fbb5f719fe64133c445d9394 100644 (file)
@@ -2,7 +2,7 @@
 Bug #33562 (date("") crashes)
 --FILE--
 <?php
-date_timezone_set("GMT");
+date_default_timezone_set("GMT");
 echo "[", date(""), "]\n";
 echo "done";
 ?>
index b9300372871df0734524c1dbb5652b1118d17a03..9f4eb7b4d27ddde8c5f2fd9abef22f4fb73ef9d4 100644 (file)
@@ -2,7 +2,7 @@
 Bug #33563 (strtotime('+1 month',$abc) cant get right time)
 --FILE--
 <?php
-date_timezone_set("GMT");
+date_default_timezone_set("GMT");
 $strCurrDate = date('Y-m-d H:i:s',strtotime('2005-06-30 21:04:23'));
 $strMonAfter = date('Y-m-d H:i:s',strtotime('+1 month',strtotime($strCurrDate)));
 
index 1b82e2ccf97803d631e152ee13ff5422065df600..5fd6a65897b64736e9a85907f6a407cbae053abb 100644 (file)
@@ -2,7 +2,7 @@
 strtotime() - Format: @timestamps
 --FILE--
 <?php
-date_timezone_set("GMT");
+date_default_timezone_set("GMT");
 
 $i = 5;
 $max = getrandmax();
index 61d34384c15c38c03d8d5f6158294dfaab53a317..147b10a8236c86c68b48e96796976d02ffbb3d74 100644 (file)
@@ -10,7 +10,7 @@ date.timezone=GMT
        putenv('TZ=Europe/London');
        echo strtotime("2005-06-18 22:15:44"), "\n";
 
-       date_timezone_set('Europe/Oslo');
+       date_default_timezone_set('Europe/Oslo');
        echo strtotime("2005-06-18 22:15:44"), "\n";
 ?>
 --EXPECT--