Commit 5725ed3b authored by Jeff Smith's avatar Jeff Smith Committed by Alexandre Julliard

ucrtbase: Strftime %y works for years 0 to 9999.

parent d0277873
......@@ -1316,7 +1316,14 @@ static MSVCRT_size_t strftime_helper(char *str, MSVCRT_size_t max, const char *f
return 0;
break;
case 'y':
if(!strftime_int(str, &ret, max, mstm->tm_year%100, alternate ? 0 : 2, 0, 99))
#if _MSVCR_VER>=140
if(!MSVCRT_CHECK_PMT(mstm->tm_year>=-1900 && mstm->tm_year<=8099))
goto einval_error;
tmp = (mstm->tm_year+1900)%100;
#else
tmp = mstm->tm_year%100;
#endif
if(!strftime_int(str, &ret, max, tmp, alternate ? 0 : 2, 0, 99))
return 0;
break;
case 'Y':
......
......@@ -379,7 +379,7 @@ static void __cdecl global_invalid_parameter_handler(
const wchar_t *expression, const wchar_t *function,
const wchar_t *file, unsigned line, uintptr_t arg)
{
CHECK_EXPECT(global_invalid_parameter_handler);
CHECK_EXPECT2(global_invalid_parameter_handler);
}
static void __cdecl thread_invalid_parameter_handler(
......@@ -928,6 +928,10 @@ static void test_strftime(void)
{"%V", "01", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }, TRUE},
{"%V", "52", { 0, 0, 0, 1, 0, 117, 0, 0, 0 }, TRUE},
{"%V", "53", { 0, 0, 14, 1, 0, 121, 6, 0, 0 }, TRUE},
{"%y", "", { 0, 0, 0, 0, 0, -1901, 0, 0, 0 }},
{"%y", "00", { 0, 0, 0, 0, 0, -1900, 0, 0, 0 }},
{"%y", "99", { 0, 0, 0, 0, 0, 8099, 0, 0, 0 }},
{"%y", "", { 0, 0, 0, 0, 0, 8100, 0, 0, 0 }},
{"%g", "71", { 0, 0, 0, 2, 0, 72, 0, 1, 0 }},
{"%g", "72", { 0, 0, 0, 3, 0, 72, 1, 2, 0 }},
{"%G", "1971", { 0, 0, 0, 2, 0, 72, 0, 1, 0 }},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment