cvs: php4 /ext/calendar easter.c
| From: | Markus Fischer | Date: | Mon, 10 Jun 2002 07:51:28 +0000 |
| Subject: | cvs: php4 /ext/calendar easter.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-12277@lists.php.net to get a copy of this message | ||
mfischer Mon Jun 10 03:51:28 2002 EDT
Modified files:
/php4/ext/calendar easter.c
Log:
- Fix easter_(days|date)()s first parameter now really defaults to the current
year if ommited (it was document but didn't work).
Index: php4/ext/calendar/easter.c
diff -u php4/ext/calendar/easter.c:1.9 php4/ext/calendar/easter.c:1.10
--- php4/ext/calendar/easter.c:1.9 Sun May 12 11:14:21 2002
+++ php4/ext/calendar/easter.c Mon Jun 10 03:51:28 2002
@@ -33,8 +33,17 @@
long year, golden, solar, lunar, pfm, dom, tmp, easter;
long method = CAL_EASTER_DEFAULT;
+ /* Default to the current year if year parameter is not given */
+ {
+ time_t a;
+ struct tm b;
+ time(&a);
+ php_localtime_r(&a, &b);
+ year = 1900 + b.tm_year;
+ }
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
- "l|l", &year, &method) == FAILURE) {
+ "|ll", &year, &method) == FAILURE) {
return;
}
@@ -116,7 +125,7 @@
}
/* }}} */
-/* {{{ proto int easter_days([int year])
+/* {{{ proto int easter_days([int year, [int method]])
Return the number of days after March 21 that Easter falls on for a given year (defaults to
current year) */
PHP_FUNCTION(easter_days)
{