MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / cmd_rtc_sync

Function cmd_rtc_sync

components/drivers/rtc/dev_soft_rtc.c:285–298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283#ifdef FINSH_USING_MSH
284#include <finsh.h>
285static void cmd_rtc_sync(int argc, char **argv)
286{
287 struct timeval tv = {0};
288 struct timezone tz = {0};
289 time_t now = (time_t)0;
290
291 rt_soft_rtc_sync();
292
293 gettimeofday(&tv, &tz);
294 now = tv.tv_sec;
295 /* output current time */
296 rt_kprintf("local time: %.*s", 25, ctime(&now));
297 rt_kprintf("timestamps: %ld\n", (long)tv.tv_sec);
298}
299MSH_CMD_EXPORT_ALIAS(cmd_rtc_sync, rtc_sync, Update time by soft rtc);
300#endif
301

Callers

nothing calls this directly

Calls 4

rt_soft_rtc_syncFunction · 0.85
gettimeofdayFunction · 0.85
rt_kprintfFunction · 0.85
ctimeFunction · 0.85

Tested by

no test coverage detected