You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/10/25 16:55:05 UTC
[incubator-nuttx] 01/02: strftime: Add support for the %R specifier
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 097faac22f308a19d0ae2f61cc707ba3f99f8e67
Author: Xavier Del Campo <xa...@midokura.com>
AuthorDate: Tue Oct 25 08:54:23 2022 +0200
strftime: Add support for the %R specifier
---
libs/libc/time/lib_strftime.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/libs/libc/time/lib_strftime.c b/libs/libc/time/lib_strftime.c
index 2c98ea30e2..cd77c34eea 100644
--- a/libs/libc/time/lib_strftime.c
+++ b/libs/libc/time/lib_strftime.c
@@ -368,6 +368,15 @@ size_t strftime(FAR char *s, size_t max, FAR const char *format,
}
break;
+ /* %R: Shortcut for %H:%M. */
+
+ case 'R':
+ {
+ len = snprintf(dest, chleft, "%02d:%02d",
+ tm->tm_hour, tm->tm_min);
+ }
+ break;
+
/* %s: The number of seconds since the Epoch, that is,
* since 1970-01-01 00:00:00 UTC.
* Hmmm... mktime argume is not 'const'.