(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)
This commit is contained in:
Sascha Schumann 2000-01-31 17:22:17 +00:00
parent 409f06b330
commit f8e1457be0

View 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;