Signed-off-by: Vijay Kiran Kamuju infyquest@gmail.com --- dlls/msvcrt/tests/time.c | 5 +++++ dlls/msvcrt/time.c | 7 +++++++ dlls/ucrtbase/tests/misc.c | 8 ++++++++ 3 files changed, 20 insertions(+)
diff --git a/dlls/msvcrt/tests/time.c b/dlls/msvcrt/tests/time.c index fea7ca19db4..faf1a6dcb46 100644 --- a/dlls/msvcrt/tests/time.c +++ b/dlls/msvcrt/tests/time.c @@ -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, "%R", 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, "%T", gmt_tm); ok(retA == 0, "expected 0, got %ld\n", retA); diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c index b7d11e0543a..c2b5523172b 100644 --- a/dlls/msvcrt/time.c +++ b/dlls/msvcrt/time.c @@ -1194,6 +1194,13 @@ static MSVCRT_size_t strftime_helper(char *str, MSVCRT_size_t max, const char *f return 0; break; #if _MSVCR_VER>=140 + case 'R': + if(!strftime_int(str, &ret, max, mstm->tm_hour, alternate ? 0 : 2, 0, 23)) + return 0; + str[ret++] = ':'; + if(!strftime_int(str, &ret, max, mstm->tm_min, alternate ? 0 : 2, 0, 59)) + return 0; + break; case 'T': if(!strftime_int(str, &ret, max, mstm->tm_hour, alternate ? 0 : 2, 0, 23)) return 0; diff --git a/dlls/ucrtbase/tests/misc.c b/dlls/ucrtbase/tests/misc.c index bb0c2e3a0a2..02ea1297bb2 100644 --- a/dlls/ucrtbase/tests/misc.c +++ b/dlls/ucrtbase/tests/misc.c @@ -895,6 +895,14 @@ static void test_strftime(void) char bufA[256]; size_t retA;
+ retA = p_strftime(bufA, sizeof(bufA), "%R", &epoch); + ok(retA == 5, "expected 5, got %d\n", (int)retA); + ok(!strcmp(bufA, "00:00"), "got %s\n", bufA); + + retA = p_strftime(bufA, sizeof(bufA), "%#R", &epoch); + ok(retA == 3, "expected 3, got %d\n", (int)retA); + ok(!strcmp(bufA, "0:0"), "got %s\n", bufA); + retA = p_strftime(bufA, sizeof(bufA), "%T", &epoch); ok(retA == 8, "expected 8, got %d\n", (int)retA); ok(!strcmp(bufA, "00:00:00"), "got %s\n", bufA);
Hi Vijay,
On 9/30/19 4:17 PM, Vijay Kiran Kamuju wrote:
case 'R':
if(!strftime_int(str, &ret, max, mstm->tm_hour, alternate ? 0 : 2, 0, 23))
return 0;
str[ret++] = ':';
I've sent changed version of the patch that takes str buffer size into account when writing ':'.
Thanks, Piotr
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=57158
Your paranoid android.
=== w2003std (32 bit report) ===
msvcrt: time.c:900: Test failed: clock() = 937, expected 1093