From 517b5eb016c93852b72cb992f95c05ba8316cf11 Mon Sep 17 00:00:00 2001 From: Lei Peng Date: Wed, 29 Mar 2023 11:02:45 +0800 Subject: [PATCH] [libc][ctime] stime clear tv.tv_usec as zero when using stime set rtc time, tv.tv_usec not 0,but always is 0xdeadbeef, make set time error --- components/libc/compilers/common/ctime.c | 1 + 1 file changed, 1 insertion(+) diff --git a/components/libc/compilers/common/ctime.c b/components/libc/compilers/common/ctime.c index 19cd789bed..c1573bf661 100644 --- a/components/libc/compilers/common/ctime.c +++ b/components/libc/compilers/common/ctime.c @@ -383,6 +383,7 @@ int stime(const time_t *t) } tv.tv_sec = *t; + tv.tv_usec = 0; if (set_timeval(&tv) == RT_EOK) { return 0;