From: Sascha Schumann Date: Mon, 31 Jan 2000 17:22:17 +0000 (+0000) Subject: (PHP mktime) Added windowing support for 0..70 X-Git-Tag: BEFORE_SAPIFICATION_FEB_10_2000~137 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f8e1457be01c21f638f846f406ddeb01b33190f6;p=php (PHP mktime) Added windowing support for 0..70 @- mktime interprets years in the range 0-70 now as 2000-2070. You can @ continue to specify the complete year (i.e. 1920) (Sascha) --- diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c index 5495ac6053..2cbf633b5f 100644 --- a/ext/standard/datetime.c +++ b/ext/standard/datetime.c @@ -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;