nsh/timedatectl: add timedatectl to get/set TZ

follow https://man7.org/linux/man-pages/man1/timedatectl.1.html

nsh> timedatectl
      TimeZone: CST, 28800
    Local time: Sat, Apr 02 05:59:43 2022 CST
Universal time: Fri, Apr 01 21:59:43 2022 GMT
      RTC time: Sun, Apr 01 21:59:42 2022

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
Jiuzhu Dong
2022-04-01 22:08:11 +08:00
committed by Xiang Xiao
parent 5b0b44f24e
commit 63f28099e3
4 changed files with 123 additions and 0 deletions

View File

@@ -154,6 +154,11 @@ static const struct cmdmap_s g_cmdmap[] =
{ "dirname", cmd_dirname, 2, 2, "<path>" },
#endif
#ifndef CONFIG_NSH_DISABLE_TIMEDATECTL
{ "timedatectl", cmd_timedatectl, 1, 3, "[set-timezone TZ]"
},
#endif
#ifndef CONFIG_NSH_DISABLE_DATE
{ "date", cmd_date, 1, 4, "[-s \"MMM DD HH:MM:SS YYYY\"] [-u]" },
#endif