From: Derick Rethans Date: Thu, 12 Jul 2007 18:59:05 +0000 (+0000) Subject: - MFH: Missing file in previous commit. X-Git-Tag: php-5.2.4RC1~165 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7588023b65fc08d7641b9f7e8ec6499bdddb048d;p=php - MFH: Missing file in previous commit. --- diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 52986630d8..b8be9e6b73 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -775,7 +775,7 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca /* year */ case 'L': length = slprintf(buffer, 32, "%d", timelib_is_leap((int) t->y)); break; case 'y': length = slprintf(buffer, 32, "%02d", (int) t->y % 100); break; - case 'Y': length = slprintf(buffer, 32, "%04d", (int) t->y); break; + case 'Y': length = slprintf(buffer, 32, "%s%04d", t->y < 0 ? "-" : "", abs((int) t->y)); break; /* time */ case 'a': length = slprintf(buffer, 32, "%s", t->h >= 12 ? "pm" : "am"); break; @@ -1740,7 +1740,7 @@ PHP_FUNCTION(date_parse) parsed_time = timelib_strtotime(date, date_len, &error, DATE_TIMEZONEDB); array_init(return_value); #define PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(name, elem) \ - if (parsed_time->elem == -1) { \ + if (parsed_time->elem == -99999) { \ add_assoc_bool(return_value, #name, 0); \ } else { \ add_assoc_long(return_value, #name, parsed_time->elem); \ @@ -1752,7 +1752,7 @@ PHP_FUNCTION(date_parse) PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(minute, i); PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(second, s); - if (parsed_time->f == -1) { + if (parsed_time->f == -99999) { add_assoc_bool(return_value, "fraction", 0); } else { add_assoc_double(return_value, "fraction", parsed_time->f);