summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannes Magnusson <bjori@php.net>2006-10-07 15:14:57 +0000
committerHannes Magnusson <bjori@php.net>2006-10-07 15:14:57 +0000
commitf76d8e55bccdcfe4c53230a54515df250499c164 (patch)
tree614f401fcecc67a66364658458fa79c0e3c4ff0e
parent62f01f5e6c4ffef76387e905f0ff1d1e83273fd8 (diff)
downloadphp-git-f76d8e55bccdcfe4c53230a54515df250499c164.tar.gz
Avoid portability problems
-rw-r--r--ext/calendar/cal_unix.c14
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", &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;
}