mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-12-26 09:08:25 +00:00
[libc][time] 重命名非标准libc函数 并 调整time.h定义位置
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* timezone */
|
||||
#define DST_NONE 0 /* not on dst */
|
||||
#define DST_USA 1 /* USA style dst */
|
||||
#define DST_AUST 2 /* Australian style dst */
|
||||
@@ -31,12 +32,21 @@ extern "C" {
|
||||
#define DST_TUR 9 /* Turkey */
|
||||
#define DST_AUSTALT 10 /* Australian style with shift in 1986 */
|
||||
|
||||
#ifndef _TIMEVAL_DEFINED
|
||||
#define _TIMEVAL_DEFINED
|
||||
struct timezone {
|
||||
int tz_minuteswest; /* minutes west of Greenwich */
|
||||
int tz_dsttime; /* type of dst correction */
|
||||
};
|
||||
|
||||
void rt_tz_set(rt_int8_t tz);
|
||||
rt_int8_t rt_tz_get(void);
|
||||
rt_int8_t rt_tz_is_dst(void);
|
||||
|
||||
/*
|
||||
* Structure returned by gettimeofday(2) system call,
|
||||
* and used in other calls.
|
||||
*/
|
||||
#ifndef _TIMEVAL_DEFINED
|
||||
#define _TIMEVAL_DEFINED
|
||||
#if !(defined(_WIN32))
|
||||
struct timeval {
|
||||
long tv_sec; /* seconds */
|
||||
@@ -45,18 +55,6 @@ struct timeval {
|
||||
#endif
|
||||
#endif /* _TIMEVAL_DEFINED */
|
||||
|
||||
#if !(defined(__GNUC__) && !defined(__ARMCC_VERSION)/*GCC*/) && !(defined(__ICCARM__) && (__VER__ >= 8010001)) && !defined(_WIN32)
|
||||
struct timespec {
|
||||
time_t tv_sec; /* seconds */
|
||||
long tv_nsec; /* and nanoseconds */
|
||||
};
|
||||
#endif
|
||||
|
||||
struct timezone {
|
||||
int tz_minuteswest; /* minutes west of Greenwich */
|
||||
int tz_dsttime; /* type of dst correction */
|
||||
};
|
||||
|
||||
int stime(const time_t *t);
|
||||
time_t timegm(struct tm * const t);
|
||||
int gettimeofday(struct timeval *tv, struct timezone *tz);
|
||||
@@ -67,6 +65,14 @@ struct tm *gmtime_r(const time_t *timep, struct tm *r);
|
||||
|
||||
#ifdef RT_USING_POSIX
|
||||
#include <sys/types.h>
|
||||
|
||||
#if !(defined(__GNUC__) && !defined(__ARMCC_VERSION)/*GCC*/) && !(defined(__ICCARM__) && (__VER__ >= 8010001)) && !defined(_WIN32)
|
||||
struct timespec {
|
||||
time_t tv_sec; /* seconds */
|
||||
long tv_nsec; /* and nanoseconds */
|
||||
};
|
||||
#endif
|
||||
|
||||
/* posix clock and timer */
|
||||
#define MILLISECOND_PER_SECOND 1000UL
|
||||
#define MICROSECOND_PER_SECOND 1000000UL
|
||||
@@ -96,15 +102,9 @@ struct tm *gmtime_r(const time_t *timep, struct tm *r);
|
||||
int clock_getres (clockid_t clockid, struct timespec *res);
|
||||
int clock_gettime (clockid_t clockid, struct timespec *tp);
|
||||
int clock_settime (clockid_t clockid, const struct timespec *tp);
|
||||
int clock_time_to_tick(const struct timespec *time);
|
||||
int rt_timespec_to_tick(const struct timespec *time);
|
||||
#endif /* RT_USING_POSIX */
|
||||
|
||||
|
||||
/* timezone APIs (Not standard LIBC APIs) */
|
||||
void rt_tz_set(rt_int8_t tz);
|
||||
rt_int8_t rt_tz_get(void);
|
||||
rt_int8_t rt_tz_is_dst(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user