]> granicus.if.org Git - php/commitdiff
- MFH: Missing file in previous commit.
authorDerick Rethans <derick@php.net>
Thu, 12 Jul 2007 18:59:05 +0000 (18:59 +0000)
committerDerick Rethans <derick@php.net>
Thu, 12 Jul 2007 18:59:05 +0000 (18:59 +0000)
ext/date/php_date.c

index 52986630d8f3e5834c671feb926ca1e68e74025e..b8be9e6b738350a48a701a2a1aff66885ddac110 100644 (file)
@@ -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);