summaryrefslogtreecommitdiff
path: root/components/libc/compilers/dlib
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2019-05-20 20:33:07 +0800
committerGitHub <[email protected]>2019-05-20 20:33:07 +0800
commitb2ae7d72f923e1638f72d8eba5c2131389b741b0 (patch)
treeab526e2e216f5f656b9c6a53221382d07c7bac2e /components/libc/compilers/dlib
parentd778c9df25cbbd8e202a0133453e4c8b8e179eff (diff)
parent35eff9a85dd1e922f98d36deed84bdfb3c8319f7 (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.c17
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