diff --git a/libs/libc/time/lib_strftime.c b/libs/libc/time/lib_strftime.c index 43be9a03d8..f8342c2d67 100644 --- a/libs/libc/time/lib_strftime.c +++ b/libs/libc/time/lib_strftime.c @@ -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;