Commit 8e1435ef authored by Vijay Kiran Kamuju's avatar Vijay Kiran Kamuju Committed by Alexandre Julliard

msvcrt: Implement %h format for strftime.

parent 6ad18ca3
...@@ -629,6 +629,11 @@ static void test_strftime(void) ...@@ -629,6 +629,11 @@ static void test_strftime(void)
ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno); ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno);
errno = 0xdeadbeef; errno = 0xdeadbeef;
retA = p_strftime(bufA, 256, "%h", 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); retA = p_strftime(bufA, 256, "%R", gmt_tm);
ok(retA == 0, "expected 0, got %ld\n", retA); ok(retA == 0, "expected 0, got %ld\n", retA);
ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno); ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno);
......
...@@ -1142,6 +1142,9 @@ static MSVCRT_size_t strftime_helper(char *str, MSVCRT_size_t max, const char *f ...@@ -1142,6 +1142,9 @@ static MSVCRT_size_t strftime_helper(char *str, MSVCRT_size_t max, const char *f
return 0; return 0;
break; break;
case 'b': case 'b':
#if _MSVCR_VER>=140
case 'h':
#endif
if(mstm->tm_mon<0 || mstm->tm_mon>11) if(mstm->tm_mon<0 || mstm->tm_mon>11)
goto einval_error; goto einval_error;
if(!strftime_str(str, &ret, max, time_data->str.names.short_mon[mstm->tm_mon])) if(!strftime_str(str, &ret, max, time_data->str.names.short_mon[mstm->tm_mon]))
......
...@@ -938,6 +938,10 @@ static void test_strftime(void) ...@@ -938,6 +938,10 @@ static void test_strftime(void)
retA = p_strftime(bufA, sizeof(bufA), "%#T", &epoch); retA = p_strftime(bufA, sizeof(bufA), "%#T", &epoch);
ok(retA == 5, "expected 5, got %d\n", (int)retA); ok(retA == 5, "expected 5, got %d\n", (int)retA);
ok(!strcmp(bufA, "0:0:0"), "got %s\n", bufA); ok(!strcmp(bufA, "0:0:0"), "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);
} }
static LONG* get_failures_counter(HANDLE *map) static LONG* get_failures_counter(HANDLE *map)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment