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/02/22 17:23:25 UTC

[incubator-nuttx-apps] 02/02: nshlib: Remove format variable from date_showtime

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-apps.git

commit 0b722cc86417c74db0604ed2c2d5b0832c9d1b78
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue Feb 15 16:24:01 2022 +0800

    nshlib: Remove format variable from date_showtime
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 nshlib/nsh_timcmds.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/nshlib/nsh_timcmds.c b/nshlib/nsh_timcmds.c
index cd20373..99b4b20 100644
--- a/nshlib/nsh_timcmds.c
+++ b/nshlib/nsh_timcmds.c
@@ -91,7 +91,6 @@ static inline int date_month(FAR const char *abbrev)
 static inline int date_showtime(FAR struct nsh_vtbl_s *vtbl,
                                 FAR const char *name, bool utc)
 {
-  static const char format[] = "%a, %b %d %H:%M:%S %Y";
   struct timespec ts;
   struct tm tm;
   char timbuf[MAX_TIME_STRING];
@@ -127,7 +126,7 @@ static inline int date_showtime(FAR struct nsh_vtbl_s *vtbl,
 
   /* Show the current time in the requested format */
 
-  ret = strftime(timbuf, MAX_TIME_STRING, format, &tm);
+  ret = strftime(timbuf, MAX_TIME_STRING, "%a, %b %d %H:%M:%S %Y", &tm);
   if (ret < 0)
     {
       nsh_error(vtbl, g_fmtcmdfailed, name, "strftime", NSH_ERRNO);