From: Hannes Magnusson Date: Sat, 7 Oct 2006 15:14:57 +0000 (+0000) Subject: Avoid portability problems X-Git-Tag: RELEASE_1_0_0RC1~1373 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f76d8e55bccdcfe4c53230a54515df250499c164;p=php Avoid portability problems --- diff --git a/ext/calendar/cal_unix.c b/ext/calendar/cal_unix.c index 9a619c7bda..a1cdd0d412 100644 --- a/ext/calendar/cal_unix.c +++ b/ext/calendar/cal_unix.c @@ -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; }