msvcrt: Implement %e 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
c5dc41e980
commit
0bdaecd2d7
|
@ -618,6 +618,11 @@ static void test_strftime(void)
|
||||||
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);
|
||||||
|
|
||||||
|
errno = 0xdeadbeef;
|
||||||
|
retA = p_strftime(bufA, 256, "%e", gmt_tm);
|
||||||
|
ok(retA == 0, "expected 0, got %ld\n", retA);
|
||||||
|
ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno);
|
||||||
|
|
||||||
errno = 0xdeadbeef;
|
errno = 0xdeadbeef;
|
||||||
retA = p_strftime(bufA, 256, "%F", gmt_tm);
|
retA = p_strftime(bufA, 256, "%F", gmt_tm);
|
||||||
ok(retA == 0, "expected 0, got %ld\n", retA);
|
ok(retA == 0, "expected 0, got %ld\n", retA);
|
||||||
|
|
|
@ -1177,6 +1177,12 @@ 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))
|
if(!strftime_int(str, &ret, max, mstm->tm_year%100, alternate ? 0 : 2, 0, 99))
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
|
case 'e':
|
||||||
|
if(!strftime_int(str, &ret, max, mstm->tm_mday, alternate ? 0 : 2, 0, 31))
|
||||||
|
return 0;
|
||||||
|
if(!alternate && str[ret-2] == '0')
|
||||||
|
str[ret-2] = ' ';
|
||||||
|
break;
|
||||||
case 'F':
|
case 'F':
|
||||||
tmp = 1900+mstm->tm_year;
|
tmp = 1900+mstm->tm_year;
|
||||||
if(!strftime_int(str, &ret, max, tmp, alternate ? 0 : 4, 0, 9999))
|
if(!strftime_int(str, &ret, max, tmp, alternate ? 0 : 4, 0, 9999))
|
||||||
|
|
|
@ -907,6 +907,14 @@ static void test_strftime(void)
|
||||||
ok(retA == 6, "expected 6, got %d\n", (int)retA);
|
ok(retA == 6, "expected 6, got %d\n", (int)retA);
|
||||||
ok(!strcmp(bufA, "1/1/70"), "got %s\n", bufA);
|
ok(!strcmp(bufA, "1/1/70"), "got %s\n", bufA);
|
||||||
|
|
||||||
|
retA = p_strftime(bufA, sizeof(bufA), "%e", &epoch);
|
||||||
|
ok(retA == 2, "expected 2, got %d\n", (int)retA);
|
||||||
|
ok(!strcmp(bufA, " 1"), "got %s\n", bufA);
|
||||||
|
|
||||||
|
retA = p_strftime(bufA, sizeof(bufA), "%#e", &epoch);
|
||||||
|
ok(retA == 1, "expected 1, got %d\n", (int)retA);
|
||||||
|
ok(!strcmp(bufA, "1"), "got %s\n", bufA);
|
||||||
|
|
||||||
retA = p_strftime(bufA, sizeof(bufA), "%F", &epoch);
|
retA = p_strftime(bufA, sizeof(bufA), "%F", &epoch);
|
||||||
ok(retA == 10, "expected 10, got %d\n", (int)retA);
|
ok(retA == 10, "expected 10, got %d\n", (int)retA);
|
||||||
ok(!strcmp(bufA, "1970-01-01"), "got %s\n", bufA);
|
ok(!strcmp(bufA, "1970-01-01"), "got %s\n", bufA);
|
||||||
|
|
Loading…
Reference in New Issue