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>
This commit is contained in:
Michal Lenc 2024-01-26 14:23:41 +01:00 committed by Xiang Xiao
parent c699b05f74
commit 61d1f37f5f

View File

@ -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;