msvcrt: Implement %R format for strftime.
Signed-off-by: Vijay Kiran Kamuju <infyquest@gmail.com> Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
30913ff564
commit
20810377ed
|
@ -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);
|
||||
|
|
|
@ -1189,6 +1189,16 @@ static MSVCRT_size_t strftime_helper(char *str, MSVCRT_size_t max, const char *f
|
|||
time_data->str.names.am : time_data->str.names.pm))
|
||||
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;
|
||||
if(ret < max)
|
||||
str[ret++] = ':';
|
||||
if(!strftime_int(str, &ret, max, mstm->tm_min, alternate ? 0 : 2, 0, 59))
|
||||
return 0;
|
||||
break;
|
||||
#endif
|
||||
case 'S':
|
||||
if(!strftime_int(str, &ret, max, mstm->tm_sec, alternate ? 0 : 2, 0, 59))
|
||||
return 0;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue