]> granicus.if.org Git - php/commitdiff
(PHP mktime) Added windowing support for 0..70
authorSascha Schumann <sas@php.net>
Mon, 31 Jan 2000 17:22:17 +0000 (17:22 +0000)
committerSascha Schumann <sas@php.net>
Mon, 31 Jan 2000 17:22:17 +0000 (17:22 +0000)
@- mktime interprets years in the range 0-70 now as 2000-2070. You can
@  continue to specify the complete year (i.e. 1920) (Sascha)

ext/standard/datetime.c

index 5495ac6053375ced0df8c5f7697680df983e9718..2cbf633b5f7bd41650db81d16487ec1a2d6c0d8a 100644 (file)
@@ -126,9 +126,13 @@ void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm)
                ** This function is then Y2K ready, and accepts a wide range of
                ** dates including the whole gregorian calendar.
                ** But it cannot represent ancestral dates prior to year 1001.
+               ** Additionally, input parameters of 0..70 are mapped to 100..170
                */
-               ta->tm_year = (*arguments[5])->value.lval
-                 - (((*arguments[5])->value.lval > 1000) ? 1900 : 0);
+               if ((*arguments[5])->value.lval < 70)
+                       ta->tm_year = (*arguments[5])->value.lval + 100;
+               else
+                       ta->tm_year = (*arguments[5])->value.lval
+                         - (((*arguments[5])->value.lval > 1000) ? 1900 : 0);
                /* fall-through */
        case 5:
                ta->tm_mday = (*arguments[4])->value.lval;