Skip to content

Commit 61d1f37

Browse files
michallencxiaoxiang781216
authored andcommitted
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 <michallenc@seznam.cz>
1 parent c699b05 commit 61d1f37

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

nshlib/nsh_timcmds.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ int cmd_timedatectl(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
501501

502502
nsh_output(vtbl, "Universal time: %s %s\n", timbuf, tm.tm_zone);
503503

504+
#ifdef CONFIG_RTC_DRIVER
504505
ret = open("/dev/rtc0", O_RDONLY);
505506
if (ret > 0)
506507
{
@@ -522,6 +523,7 @@ int cmd_timedatectl(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
522523

523524
nsh_output(vtbl, " RTC time: %s\n", timbuf);
524525
}
526+
#endif /* CONFIG_RTC_DRIVER */
525527
}
526528

527529
return ret;

0 commit comments

Comments
 (0)