summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Peng <[email protected]>2023-03-29 11:02:45 +0800
committerMan, Jianting (Meco) <[email protected]>2023-03-30 23:57:19 -0400
commit517b5eb016c93852b72cb992f95c05ba8316cf11 (patch)
treed275ce9819a38f7ff095bad5c17843f2dc48856f
parentba6a27c85061a0167a6629e03fad6b3629dbb6a5 (diff)
[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
-rw-r--r--components/libc/compilers/common/ctime.c1
1 files changed, 1 insertions, 0 deletions
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;