diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c index d7f239bea152aa557a9aa6ff94dfc50de64d8540..bdbb27bce429559ee739d83a5e52c5953956e214 100644 --- a/components/libc/compilers/common/time.c +++ b/components/libc/compilers/common/time.c @@ -213,10 +213,9 @@ RT_WEAK clock_t clock(void) /* TODO: timezone */ int gettimeofday(struct timeval *tp, struct timezone *tz) { - time_t t = time(RT_NULL); if (tp != RT_NULL) { - tp->tv_sec = t; + tp->tv_sec = time(RT_NULL); tp->tv_usec = 0; } return 0;