diff options
| author | armink <[email protected]> | 2018-05-03 15:45:36 +0800 |
|---|---|---|
| committer | armink <[email protected]> | 2018-05-03 15:45:36 +0800 |
| commit | 2d9798ac3d3dc8e9f3049748419c4ea179138531 (patch) | |
| tree | 6dcaac1fc853d48c466365a9257d09547ddc8f0e /components/libc/compilers/armlibc | |
| parent | 5dd0539293ef38a56a49abec8003bc70b6db7dfb (diff) | |
[Components/libc] Fix time.c code style in armlibc and dlib.
Diffstat (limited to 'components/libc/compilers/armlibc')
| -rw-r--r-- | components/libc/compilers/armlibc/time.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/components/libc/compilers/armlibc/time.c b/components/libc/compilers/armlibc/time.c index 701b57fb27..acd69f57c8 100644 --- a/components/libc/compilers/armlibc/time.c +++ b/components/libc/compilers/armlibc/time.c @@ -1,23 +1,25 @@ #include <sys/time.h> +#include <rtdevice.h> +#if defined(RT_USING_DEVICE) && defined(RT_USING_RTC) int gettimeofday(struct timeval *tp, void *ignore) { - time_t time; - rt_device_t device; + time_t time; + 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; - } + 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; + } - return time; - } + return time; + } - return 0; + return 0; } - +#endif |
