diff options
| author | 周传福 <[email protected]> | 2019-05-19 14:37:34 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-05-19 14:37:34 +0800 |
| commit | 24f38acf5265a7bc53b81014d91ce43d7db5e777 (patch) | |
| tree | 251ad85c701eb8b92944b6d5520d4acf4bcf5a61 /components/libc/compilers/dlib | |
| parent | 6ebb2c75d956449fa535481c42933bdb94b691c8 (diff) | |
| parent | c8efc0032de0e5f93218bf4a118f7b696d54d254 (diff) | |
Merge branch 'master' into stm32_uart_tx_dma
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 |
