diff options
| author | zhangjun <[email protected]> | 2019-08-27 15:03:01 +0800 |
|---|---|---|
| committer | zhangjun <[email protected]> | 2019-08-27 15:03:01 +0800 |
| commit | 6910a9e97b93ed7d60042b3a78439cdfe82e50ee (patch) | |
| tree | 31050a1df693ded018ae6ef06b2d69f420d88f84 /components/libc | |
| parent | 6d66cd6ed0a89e69ae2521301241600b0b973d24 (diff) | |
修复IAR8.1之后出现的__localtime32等重定义错误
Diffstat (limited to 'components/libc')
| -rw-r--r-- | components/libc/compilers/common/time.c | 40 |
1 files changed, 3 insertions, 37 deletions
diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c index 0ab9f6980e..ed7a232079 100644 --- a/components/libc/compilers/common/time.c +++ b/components/libc/compilers/common/time.c @@ -8,13 +8,10 @@ * 2019-08-21 zhangjun copy from minilibc */ -#if defined(__CC_ARM) || defined(__CLANG_ARM) || defined (__IAR_SYSTEMS_ICC__) #include <time.h> #include <rtthread.h> -/* seconds per day */ -#define SPD 24*60*60 - +#if !defined (__IAR_SYSTEMS_ICC__) /* days per month -- nonleap! */ const short __spm[13] = @@ -93,15 +90,7 @@ struct tm *gmtime_r(const time_t *timep, struct tm *r) return r; } -#if defined (__IAR_SYSTEMS_ICC__) && (__VER__) >= 6020000 -#if _DLIB_TIME_USES_64 -struct tm* __gmtime64(const time_t* t) -#else -struct tm* __gmtime32(const time_t* t) -#endif -#else struct tm* gmtime(const time_t* t) -#endif { static struct tm tmp; return gmtime_r(t, &tmp); @@ -113,29 +102,13 @@ struct tm* localtime_r(const time_t* t, struct tm* r) return gmtime_r(t, r); } -#if defined (__IAR_SYSTEMS_ICC__) && (__VER__) >= 6020000 -#if _DLIB_TIME_USES_64 -struct tm* __localtime64(const time_t* t) -#else -struct tm* __localtime32(const time_t* t) -#endif -#else struct tm* localtime(const time_t* t) -#endif { static struct tm tmp; return localtime_r(t, &tmp); } -#if defined (__IAR_SYSTEMS_ICC__) && (__VER__) >= 6020000 -#if _DLIB_TIME_USES_64 -time_t __mktime64(struct tm * const t) -#else -time_t __mktime32(struct tm * const t) -#endif -#else time_t mktime(struct tm * const t) -#endif { register time_t day; register time_t i; @@ -242,15 +215,7 @@ char* asctime(const struct tm *timeptr) return asctime_r(timeptr, buf); } -#if defined (__IAR_SYSTEMS_ICC__) && (__VER__) >= 6020000 -#if _DLIB_TIME_USES_64 -char* __ctime64(const time_t *timep) -#else -char* __ctime32(const time_t *timep) -#endif -#else char* ctime(const time_t *timep) -#endif { return asctime(localtime(timep)); } @@ -285,6 +250,8 @@ int _gettimeofday( struct timeval *tv, void *ignore) } #endif +#endif /* __IAR_SYSTEMS_ICC__ */ + /** * Returns the current time. * @@ -340,4 +307,3 @@ RT_WEAK clock_t clock(void) { return rt_tick_get(); } -#endif |
