Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed
Fork of ICE by
Diff: src/CommandParser/cmd.cpp
- Revision:
- 62:1b1d7918adf2
- Parent:
- 54:ec1b03064bbd
- Child:
- 63:0ded43237b22
--- a/src/CommandParser/cmd.cpp Wed Sep 14 22:26:43 2016 +0000 +++ b/src/CommandParser/cmd.cpp Thu Sep 15 16:17:08 2016 +0000 @@ -37,6 +37,7 @@ #include "ConfigurationHandler.h" #include "mDot.h" #include "rtos.h" +#include "rtc.h" Serial serial(USBTX, USBRX); ntshell_t ntshell; @@ -70,6 +71,7 @@ {"snr-stats", "get current SNR stats", cmd_snrStats }, {"stack", "get thread stack usage stats", cmd_stack }, {"stats", "get current mDot statistics", cmd_stats }, + {"time", "get current time", cmd_time }, {NULL, NULL, NULL} }; @@ -649,3 +651,21 @@ printf("\r\n"); } + +/***************************************************************************** + * Function: cmd_time + * Description: display real-time clock + * + * @param argc (not used) + * @param argv (not used) + * @return none + *****************************************************************************/ +void cmd_time(int argc, char **argv) +{ + UNUSED(argc); + UNUSED(argv); + + int iyr=0, imo=0, idy=0, ihr=0, imn=0, isc=0; + rtc_get_time(&iyr, &imo, &idy, &ihr, &imn, &isc); + printf("%04d-%02d-%02d %02d:%02d:%02d\r\n", iyr, imo, idy, ihr, imn, isc); +} \ No newline at end of file