cvs: php-src /ext/calendar cal_unix.c

From: Date: Sat, 07 Oct 2006 15:14:57 +0000
Subject: cvs: php-src /ext/calendar cal_unix.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-40980@lists.php.net to get a copy of this message
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", &timestamp) == 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; }

« previous php.cvs (#40980) next »