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


The following commit(s) were added to refs/heads/master by this push:
     new 61d1f37f5 nsh_timcmds: show RTC time in timedatectl command only if 
CONFIG_RTC_DRIVER is set
61d1f37f5 is described below

commit 61d1f37f5f6b651534632fac0485e904312299d9
Author: Michal Lenc <[email protected]>
AuthorDate: Fri Jan 26 14:23:41 2024 +0100

    nsh_timcmds: show RTC time in timedatectl command only if CONFIG_RTC_DRIVER 
is set
    
    NuttX build fails otherwise as required structures are not included.
    
    Signed-off-by: Michal Lenc <[email protected]>
---
 nshlib/nsh_timcmds.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/nshlib/nsh_timcmds.c b/nshlib/nsh_timcmds.c
index 19d53ebc1..11ba98b5f 100644
--- a/nshlib/nsh_timcmds.c
+++ b/nshlib/nsh_timcmds.c
@@ -501,6 +501,7 @@ int cmd_timedatectl(FAR struct nsh_vtbl_s *vtbl, int argc, 
FAR char **argv)
 
       nsh_output(vtbl, "Universal time: %s %s\n", timbuf, tm.tm_zone);
 
+#ifdef CONFIG_RTC_DRIVER
       ret = open("/dev/rtc0", O_RDONLY);
       if (ret > 0)
         {
@@ -522,6 +523,7 @@ int cmd_timedatectl(FAR struct nsh_vtbl_s *vtbl, int argc, 
FAR char **argv)
 
           nsh_output(vtbl, "      RTC time: %s\n", timbuf);
         }
+#endif /* CONFIG_RTC_DRIVER */
     }
 
   return ret;

Reply via email to