msvcrt: Implement %C format for strftime.
Signed-off-by: Vijay Kiran Kamuju <infyquest@gmail.com> Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ff5644174e
commit
3762402779
|
@ -608,6 +608,11 @@ static void test_strftime(void)
|
|||
gmt_tm = p_gmtime(&gmt);
|
||||
ok(gmt_tm != NULL, "gmtime failed\n");
|
||||
|
||||
errno = 0xdeadbeef;
|
||||
retA = p_strftime(bufA, 256, "%C", gmt_tm);
|
||||
ok(retA == 0, "expected 0, got %ld\n", retA);
|
||||
ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno);
|
||||
|
||||
errno = 0xdeadbeef;
|
||||
retA = p_strftime(bufA, 256, "%D", gmt_tm);
|
||||
ok(retA == 0, "expected 0, got %ld\n", retA);
|
||||
|
|
|
@ -1153,6 +1153,13 @@ static MSVCRT_size_t strftime_helper(char *str, MSVCRT_size_t max, const char *f
|
|||
if(!strftime_str(str, &ret, max, time_data->str.names.mon[mstm->tm_mon]))
|
||||
return 0;
|
||||
break;
|
||||
#if _MSVCR_VER>=140
|
||||
case 'C':
|
||||
tmp = (1900+mstm->tm_year)/100;
|
||||
if(!strftime_int(str, &ret, max, tmp, alternate ? 0 : 2, 0, 99))
|
||||
return 0;
|
||||
break;
|
||||
#endif
|
||||
case 'd':
|
||||
if(!strftime_int(str, &ret, max, mstm->tm_mday, alternate ? 0 : 2, 0, 31))
|
||||
return 0;
|
||||
|
|
|
@ -895,6 +895,10 @@ static void test_strftime(void)
|
|||
char bufA[256];
|
||||
size_t retA;
|
||||
|
||||
retA = p_strftime(bufA, sizeof(bufA), "%C", &epoch);
|
||||
ok(retA == 2, "expected 2, got %d\n", (int)retA);
|
||||
ok(!strcmp(bufA, "19"), "got %s\n", bufA);
|
||||
|
||||
retA = p_strftime(bufA, sizeof(bufA), "%D", &epoch);
|
||||
ok(retA == 8, "expected 8, got %d\n", (int)retA);
|
||||
ok(!strcmp(bufA, "01/01/70"), "got %s\n", bufA);
|
||||
|
|
Loading…
Reference in New Issue