diff options
| author | Meco Man <[email protected]> | 2021-02-07 22:09:22 +0800 |
|---|---|---|
| committer | Meco Man <[email protected]> | 2021-02-07 22:09:22 +0800 |
| commit | 0d30632de6864a7cfaaa3a1de78ff7ef8f77539a (patch) | |
| tree | e7b629790adaf5052a062f203a953aa098dfaf5b /components/libc/compilers/common | |
| parent | 852d7d7552bd3fe898115ea16ba401970b0d1fad (diff) | |
fix #3976
Diffstat (limited to 'components/libc/compilers/common')
| -rw-r--r-- | components/libc/compilers/common/time.c | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c index e2dae1feaf..ad167a85c7 100644 --- a/components/libc/compilers/common/time.c +++ b/components/libc/compilers/common/time.c @@ -213,22 +213,12 @@ RT_WEAK clock_t clock(void) /* TODO: timezone */ int gettimeofday(struct timeval *tp, struct timezone *tz) { - time_t time = 0; -#ifdef RT_USING_DEVICE - rt_device_t device; - device = rt_device_find("rtc"); - RT_ASSERT(device != RT_NULL); - rt_device_control(device, RT_DEVICE_CTRL_RTC_GET_TIME, &time); + time_t time = time(NULL); if (tp != RT_NULL) { tp->tv_sec = time; tp->tv_usec = 0; } -#else - tv->tv_sec = 0; - tv->tv_usec = 0; -#endif - return time; } |
