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

msvcrt: Implement %u format for strftime.

parent 6c6afb2c
......@@ -654,6 +654,11 @@ static void test_strftime(void)
ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno);
errno = 0xdeadbeef;
retA = p_strftime(bufA, 256, "%u", 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(NULL, 0, "copy", gmt_tm);
ok(retA == 0, "expected 0, got %ld\n", retA);
ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno);
......
......@@ -1264,6 +1264,11 @@ static MSVCRT_size_t strftime_helper(char *str, MSVCRT_size_t max, const char *f
if(!strftime_int(str, &ret, max, mstm->tm_sec, alternate ? 0 : 2, 0, 59))
return 0;
break;
case 'u':
tmp = mstm->tm_wday ? mstm->tm_wday : 7;
if(!strftime_int(str, &ret, max, tmp, 0, 1, 7))
return 0;
break;
#endif
case 'w':
if(!strftime_int(str, &ret, max, mstm->tm_wday, 0, 0, 6))
......
......@@ -901,6 +901,7 @@ static void test_asctime(void)
static void test_strftime(void)
{
const struct tm epoch = { 0, 0, 0, 1, 0, 70, 4, 0, 0 };
const struct tm tm1 = { 0, 0, 0, 1, 0, 117, 0, 0, 0 };
char bufA[256];
size_t retA;
......@@ -948,6 +949,10 @@ static void test_strftime(void)
ok(retA == 5, "expected 5, got %d\n", (int)retA);
ok(!strcmp(bufA, "0:0:0"), "got %s\n", bufA);
retA = p_strftime(bufA, sizeof(bufA), "%u", &tm1);
ok(retA == 1, "expected 1, got %d\n", (int)retA);
ok(!strcmp(bufA, "7"), "got %s\n", bufA);
retA = p_strftime(bufA, sizeof(bufA), "%h", &epoch);
ok(retA == 3, "expected 3, got %d\n", (int)retA);
ok(!strcmp(bufA, "Jan"), "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