Signed-off-by: Vijay Kiran Kamuju <infyquest(a)gmail.com>
---
dlls/msvcrt/tests/time.c | 5 +++++
dlls/msvcrt/time.c | 5 +++++
dlls/ucrtbase/tests/misc.c | 5 +++++
3 files changed, 15 insertions(+)
diff --git a/dlls/msvcrt/tests/time.c b/dlls/msvcrt/tests/time.c
index 0eecfd6796f..cf79e5971ec 100644
--- a/dlls/msvcrt/tests/time.c
+++ b/dlls/msvcrt/tests/time.c
@@ -653,6 +653,11 @@ static void test_strftime(void)
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, "%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);
diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c
index b299976d3f3..588f724cf79 100644
--- a/dlls/msvcrt/time.c
+++ b/dlls/msvcrt/time.c
@@ -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))
diff --git a/dlls/ucrtbase/tests/misc.c b/dlls/ucrtbase/tests/misc.c
index fe59e300623..83e1bdda888 100644
--- a/dlls/ucrtbase/tests/misc.c
+++ b/dlls/ucrtbase/tests/misc.c
@@ -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 epoch2 = { 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", &epoch2);
+ 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);
--
2.21.0