From 46d51a99f1b92738a2955245527ad8e18bcf96a5 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Thu, 15 Apr 2021 16:34:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96get=5Ftimeval=20set=5Ftimeval?= =?UTF-8?q?=20=E6=9D=A1=E4=BB=B6=E7=BC=96=E8=AF=91=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/libc/compilers/common/time.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c index 638735b77c..33d8907165 100644 --- a/components/libc/compilers/common/time.c +++ b/components/libc/compilers/common/time.c @@ -77,7 +77,6 @@ static int get_timeval(struct timeval *tv) { #ifdef RT_USING_RTC static rt_device_t device = RT_NULL; -#endif rt_err_t rst = -RT_ERROR; if (tv == RT_NULL) @@ -87,7 +86,6 @@ static int get_timeval(struct timeval *tv) tv->tv_sec = 0; tv->tv_usec = 0; -#ifdef RT_USING_RTC /* optimization: find rtc device only first */ if (device == RT_NULL) { @@ -127,15 +125,13 @@ static int get_timeval(struct timeval *tv) */ static int set_timeval(struct timeval *tv) { - rt_err_t rst = -RT_ERROR; #ifdef RT_USING_RTC static rt_device_t device = RT_NULL; -#endif + rt_err_t rst = -RT_ERROR; if (tv == RT_NULL) return -1; -#ifdef RT_USING_RTC /* optimization: find rtc device only first */ if (device == RT_NULL) { @@ -311,7 +307,7 @@ RT_WEAK time_t time(time_t *t) else { errno = EFAULT; - return -1; + return ((time_t)-1); } } RTM_EXPORT(time);