libc: Add more conversion specifiers to strftime
This commit is contained in:
parent
b7df596f8a
commit
8c4ead0c0f
@ -84,7 +84,12 @@ extern "C"
|
||||
case 'B':
|
||||
if (!try_put_string(state, mon_names[tm->tm_mon])) return 0;
|
||||
break;
|
||||
case 'c': todo();
|
||||
case 'c':
|
||||
if (!try_format(state, "%s %s %.2d %.2d:%.2d:%.2d %d", abday_names[tm->tm_wday],
|
||||
abmon_names[tm->tm_mon], tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,
|
||||
tm->tm_year + 1900))
|
||||
return 0;
|
||||
break;
|
||||
case 'd':
|
||||
if (!try_format(state, "%.2d", tm->tm_mday)) return 0;
|
||||
break;
|
||||
@ -117,8 +122,13 @@ extern "C"
|
||||
case 'S':
|
||||
if (!try_format(state, "%.2d", tm->tm_sec)) return 0;
|
||||
break;
|
||||
case 'x': todo();
|
||||
case 'X': todo();
|
||||
case 'x':
|
||||
// Sorry, Americans, but I ain't doing m/d/y.
|
||||
if (!try_format(state, "%.2d/%.2d/%.2d", tm->tm_mday, tm->tm_mon + 1, tm->tm_year + 1900)) return 0;
|
||||
break;
|
||||
case 'X':
|
||||
if (!try_format(state, "%.2d:%.2d:%.2d", tm->tm_hour, tm->tm_min, tm->tm_sec)) return 0;
|
||||
break;
|
||||
case 'y':
|
||||
if (!try_format(state, "%.2d", (tm->tm_year + 1900) % 100)) return 0;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user