From 702b510dc6147ec97986049fced0e893fa1e1332 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Mon, 30 Oct 2000 16:13:03 +0000 Subject: [PATCH] Don't try to work with negative timestamps # It returns the same day as for 0, which is wrong --- ext/calendar/cal_unix.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ext/calendar/cal_unix.c b/ext/calendar/cal_unix.c index b23215c8620..c57a82b4590 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);