From 3c4bff5c8a3d01afde657183df7ff09cfec8e82c Mon Sep 17 00:00:00 2001 From: bluebear233 <417350690@qq.com> Date: Mon, 30 Jun 2025 16:16:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8gettimeofday=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E4=B8=AD=E6=B7=BB=E5=8A=A0=E5=AF=B9RTC=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E7=94=A8=E6=97=B6=E4=BD=BF=E7=94=A8=E6=BB=B4?= =?UTF-8?q?=E7=AD=94=E8=AE=A1=E6=95=B0=E7=9A=84=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/libc/compilers/common/ctime.c | 5 +++++ 1 file changed, 5 insertions(+) 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 */