diff options
| author | Hannes Magnusson <bjori@php.net> | 2006-10-07 15:14:57 +0000 |
|---|---|---|
| committer | Hannes Magnusson <bjori@php.net> | 2006-10-07 15:14:57 +0000 |
| commit | f76d8e55bccdcfe4c53230a54515df250499c164 (patch) | |
| tree | 614f401fcecc67a66364658458fa79c0e3c4ff0e | |
| parent | 62f01f5e6c4ffef76387e905f0ff1d1e83273fd8 (diff) | |
| download | php-git-f76d8e55bccdcfe4c53230a54515df250499c164.tar.gz | |
Avoid portability problems
| -rw-r--r-- | ext/calendar/cal_unix.c | 14 |
1 files changed, 10 insertions, 4 deletions
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; } |
