msvcrt: Implement %n and %t formats 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
90e520b418
commit
c583c4afaa
|
@ -633,11 +633,21 @@ 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, "%n", 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);
|
||||
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);
|
||||
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);
|
||||
|
|
|
@ -1225,6 +1225,11 @@ static MSVCRT_size_t strftime_helper(char *str, MSVCRT_size_t max, const char *f
|
|||
if(!strftime_int(str, &ret, max, mstm->tm_min, alternate ? 0 : 2, 0, 59))
|
||||
return 0;
|
||||
break;
|
||||
#if _MSVCR_VER>=140
|
||||
case 'n':
|
||||
str[ret++] = '\n';
|
||||
break;
|
||||
#endif
|
||||
case 'p':
|
||||
if(mstm->tm_hour<0 || mstm->tm_hour>23)
|
||||
goto einval_error;
|
||||
|
@ -1247,6 +1252,9 @@ static MSVCRT_size_t strftime_helper(char *str, MSVCRT_size_t max, const char *f
|
|||
return 0;
|
||||
break;
|
||||
#if _MSVCR_VER>=140
|
||||
case 't':
|
||||
str[ret++] = '\t';
|
||||
break;
|
||||
case 'T':
|
||||
if(!strftime_int(str, &ret, max, mstm->tm_hour, alternate ? 0 : 2, 0, 23))
|
||||
return 0;
|
||||
|
|
|
@ -942,6 +942,14 @@ static void test_strftime(void)
|
|||
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);
|
||||
|
||||
retA = p_strftime(bufA, sizeof(bufA), "%n", &epoch);
|
||||
ok(retA == 1, "expected 1, got %d\n", (int)retA);
|
||||
ok(!strcmp(bufA, "\n"), "got %s\n", bufA);
|
||||
|
||||
retA = p_strftime(bufA, sizeof(bufA), "%t", &epoch);
|
||||
ok(retA == 1, "expected 1, got %d\n", (int)retA);
|
||||
ok(!strcmp(bufA, "\t"), "got %s\n", bufA);
|
||||
}
|
||||
|
||||
static LONG* get_failures_counter(HANDLE *map)
|
||||
|
|
Loading…
Reference in New Issue