Commit 37624027 authored by Vijay Kiran Kamuju's avatar Vijay Kiran Kamuju Committed by Alexandre Julliard

msvcrt: Implement %C format for strftime.

parent ff564417
......@@ -609,6 +609,11 @@ static void test_strftime(void)
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);
ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno);
......
......@@ -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);
......
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