From: Stanislav Malyshev Date: Mon, 30 Oct 2000 16:13:03 +0000 (+0000) Subject: Don't try to work with negative timestamps X-Git-Tag: php-4.0.4RC3~435 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=702b510dc6147ec97986049fced0e893fa1e1332;p=php Don't try to work with negative timestamps # It returns the same day as for 0, which is wrong --- 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);