summaryrefslogtreecommitdiff
path: root/ext/calendar
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2000-10-30 16:13:03 +0000
committerStanislav Malyshev <stas@php.net>2000-10-30 16:13:03 +0000
commit702b510dc6147ec97986049fced0e893fa1e1332 (patch)
treed7f5656a68f441d5e3398ea4f9228c0ee0951c98 /ext/calendar
parent1f7a3b3b1172f7c6498c935fb2d9c541f2054bd7 (diff)
downloadphp-git-702b510dc6147ec97986049fced0e893fa1e1332.tar.gz
Don't try to work with negative timestamps
# It returns the same day as for 0, which is wrong
Diffstat (limited to 'ext/calendar')
-rw-r--r--ext/calendar/cal_unix.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/calendar/cal_unix.c b/ext/calendar/cal_unix.c
index b23215c862..c57a82b459 100644
--- a/ext/calendar/cal_unix.c
+++ b/ext/calendar/cal_unix.c
@@ -45,6 +45,10 @@ PHP_FUNCTION(unixtojd)
t = time(NULL);
}
+ if(t < 0) {
+ RETURN_FALSE;
+ }
+
ta = php_localtime_r(&t, &tmbuf);
jdate = GregorianToSdn(ta->tm_year+1900, ta->tm_mon+1,ta->tm_mday);