Signed-off-by: Vijay Kiran Kamuju infyquest@gmail.com --- dlls/msvcrt/tests/time.c | 5 +++++ dlls/msvcrt/time.c | 14 ++++++++++++++ dlls/ucrtbase/tests/misc.c | 8 ++++++++ 3 files changed, 27 insertions(+)
diff --git a/dlls/msvcrt/tests/time.c b/dlls/msvcrt/tests/time.c index faf1a6dcb46..1bc9f3802b2 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, "%D", 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, "%R", gmt_tm); ok(retA == 0, "expected 0, got %ld\n", retA); diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c index c72b3ed21ee..7fe85295185 100644 --- a/dlls/msvcrt/time.c +++ b/dlls/msvcrt/time.c @@ -1157,6 +1157,20 @@ static MSVCRT_size_t strftime_helper(char *str, MSVCRT_size_t max, const char *f if(!strftime_int(str, &ret, max, mstm->tm_mday, alternate ? 0 : 2, 0, 31)) return 0; break; +#if _MSVCR_VER>=140 + case 'D': + if(!strftime_int(str, &ret, max, mstm->tm_mon+1, alternate ? 0 : 2, 1, 12)) + return 0; + if(ret < max) + str[ret++] = '/'; + if(!strftime_int(str, &ret, max, mstm->tm_mday, alternate ? 0 : 2, 0, 31)) + return 0; + if(ret < max) + str[ret++] = '/'; + if(!strftime_int(str, &ret, max, mstm->tm_year%100, alternate ? 0 : 2, 0, 99)) + return 0; + break; +#endif case 'H': 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 02ea1297bb2..77221566b54 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), "%D", &epoch); + ok(retA == 8, "expected 8, got %d\n", (int)retA); + ok(!strcmp(bufA, "01/01/70"), "got %s\n", bufA); + + retA = p_strftime(bufA, sizeof(bufA), "%#D", &epoch); + ok(retA == 6, "expected 6, got %d\n", (int)retA); + ok(!strcmp(bufA, "1/1/70"), "got %s\n", bufA); + 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);
Signed-off-by: Vijay Kiran Kamuju infyquest@gmail.com --- dlls/msvcrt/tests/time.c | 5 +++++ dlls/msvcrt/time.c | 13 +++++++++++++ dlls/ucrtbase/tests/misc.c | 8 ++++++++ 3 files changed, 26 insertions(+)
diff --git a/dlls/msvcrt/tests/time.c b/dlls/msvcrt/tests/time.c index 1bc9f3802b2..016c9775de7 100644 --- a/dlls/msvcrt/tests/time.c +++ b/dlls/msvcrt/tests/time.c @@ -613,6 +613,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, "%F", 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, "%R", gmt_tm); ok(retA == 0, "expected 0, got %ld\n", retA); diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c index 7fe85295185..450663fd1f5 100644 --- a/dlls/msvcrt/time.c +++ b/dlls/msvcrt/time.c @@ -1170,6 +1170,19 @@ static MSVCRT_size_t strftime_helper(char *str, MSVCRT_size_t max, const char *f if(!strftime_int(str, &ret, max, mstm->tm_year%100, alternate ? 0 : 2, 0, 99)) return 0; break; + case 'F': + tmp = 1900+mstm->tm_year; + if(!strftime_int(str, &ret, max, tmp, alternate ? 0 : 4, 0, 9999)) + return 0; + if(ret < max) + str[ret++] = '-'; + if(!strftime_int(str, &ret, max, mstm->tm_mon+1, alternate ? 0 : 2, 1, 12)) + return 0; + if(ret < max) + str[ret++] = '-'; + if(!strftime_int(str, &ret, max, mstm->tm_mday, alternate ? 0 : 2, 0, 31)) + return 0; + break; #endif case 'H': if(!strftime_int(str, &ret, max, mstm->tm_hour, alternate ? 0 : 2, 0, 23)) diff --git a/dlls/ucrtbase/tests/misc.c b/dlls/ucrtbase/tests/misc.c index 77221566b54..c58b6315656 100644 --- a/dlls/ucrtbase/tests/misc.c +++ b/dlls/ucrtbase/tests/misc.c @@ -903,6 +903,14 @@ static void test_strftime(void) ok(retA == 6, "expected 6, got %d\n", (int)retA); ok(!strcmp(bufA, "1/1/70"), "got %s\n", bufA);
+ retA = p_strftime(bufA, sizeof(bufA), "%F", &epoch); + ok(retA == 10, "expected 10, got %d\n", (int)retA); + ok(!strcmp(bufA, "1970-01-01"), "got %s\n", bufA); + + retA = p_strftime(bufA, sizeof(bufA), "%#F", &epoch); + ok(retA == 8, "expected 8, got %d\n", (int)retA); + ok(!strcmp(bufA, "1970-1-1"), "got %s\n", bufA); + 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);
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=57220
Your paranoid android.
=== w2003std (32 bit report) ===
msvcrt: time.c:910: Test failed: clock() = 296, expected 468
Signed-off-by: Piotr Caban piotr@codeweavers.com
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=57219
Your paranoid android.
=== wvistau64_fr (32 bit report) ===
msvcrt: time.c:905: Test failed: clock() = 15, expected 187
=== wvistau64_he (32 bit report) ===
msvcrt: time.c:905: Test failed: clock() = 31, expected 12074