lib_strftime: Fix %I to avoid printing 00:xx AM/PM
Currently strftime is printing 00:00 AM and 00:00 PM instead of 12:00 AM and 12:00 PM when using %I. This commit fixes this issue!
This commit is contained in:
parent
1a06f7a2c9
commit
95f131c3c2
|
@ -267,7 +267,8 @@ size_t strftime(FAR char *s, size_t max, FAR const char *format,
|
|||
|
||||
case 'I':
|
||||
{
|
||||
len = snprintf(dest, chleft, "%02d", tm->tm_hour % 12);
|
||||
len = snprintf(dest, chleft, "%02d", (tm->tm_hour % 12) != 0 ?
|
||||
(tm->tm_hour % 12) : 12);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue