diff --git a/components/libc/compilers/common/ctime.c b/components/libc/compilers/common/ctime.c index 7910356704e..4e0c3a769cd 100644 --- a/components/libc/compilers/common/ctime.c +++ b/components/libc/compilers/common/ctime.c @@ -497,6 +497,11 @@ int gettimeofday(struct timeval *tv, struct timezone *tz) { return 0; } + else + { + // if RTC device is not available, use tick count + tv->tv_sec = rt_tick_get() / RT_TICK_PER_SECOND; + } } } #endif /* RT_USING_RTC */