diff options
| author | Bernard Xiong <[email protected]> | 2019-05-20 20:33:07 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-05-20 20:33:07 +0800 |
| commit | b2ae7d72f923e1638f72d8eba5c2131389b741b0 (patch) | |
| tree | ab526e2e216f5f656b9c6a53221382d07c7bac2e /components/libc/compilers/dlib | |
| parent | d778c9df25cbbd8e202a0133453e4c8b8e179eff (diff) | |
| parent | 35eff9a85dd1e922f98d36deed84bdfb3c8319f7 (diff) | |
Merge pull request #2703 from armink/lts-v3.1.x
Lts v3.1.x
Diffstat (limited to 'components/libc/compilers/dlib')
| -rw-r--r-- | components/libc/compilers/dlib/time.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/components/libc/compilers/dlib/time.c b/components/libc/compilers/dlib/time.c index 87574df851..df35313b0e 100644 --- a/components/libc/compilers/dlib/time.c +++ b/components/libc/compilers/dlib/time.c @@ -16,19 +16,16 @@ int gettimeofday(struct timeval *tp, void *ignore) rt_device_t device; device = rt_device_find("rtc"); - if (device != RT_NULL) - { - rt_device_control(device, RT_DEVICE_CTRL_RTC_GET_TIME, &time); - if (tp != RT_NULL) - { - tp->tv_sec = time; - tp->tv_usec = 0; - } + RT_ASSERT(device != RT_NULL); - return time; + rt_device_control(device, RT_DEVICE_CTRL_RTC_GET_TIME, &time); + if (tp != RT_NULL) + { + tp->tv_sec = time; + tp->tv_usec = 0; } - return 0; + return time; } #endif |
