bjori Sat Oct 7 15:14:57 2006 UTC
Modified files:
/php-src/ext/calendar cal_unix.c
Log:
Avoid portability problems
http://cvs.php.net/viewvc.cgi/php-src/ext/calendar/cal_unix.c?r1=1.20&r2=1.21&diff_format=u
Index: php-src/ext/calendar/cal_unix.c
diff -u php-src/ext/calendar/cal_unix.c:1.20
php-src/ext/calendar/cal_unix.c:1.21
--- php-src/ext/calendar/cal_unix.c:1.20 Wed Oct 4 12:50:02 2006
+++ php-src/ext/calendar/cal_unix.c Sat Oct 7 15:14:57 2006
@@ -28,15 +28,21 @@
Convert UNIX timestamp to Julian Day */
PHP_FUNCTION(unixtojd)
{
- time_t timestamp = time(NULL);
- long jdate;
+ time_t timestamp;
+ long jdate, t;
struct tm *ta, tmbuf;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", ×tamp) ==
FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &t) == FAILURE) {
return;
}
- if(timestamp < 0) {
+ if (ZEND_NUM_ARGS()) {
+ timestamp = (time_t) t;
+ } else {
+ timestamp = time(NULL);
+ }
+
+ if (timestamp < 0) {
RETURN_FALSE;
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php