|
@@ -12,7 +12,8 @@
|
|
#define __SYS_TIME_H__
|
|
#define __SYS_TIME_H__
|
|
|
|
|
|
#include <rtconfig.h>
|
|
#include <rtconfig.h>
|
|
-#include <rtdef.h>
|
|
|
|
|
|
+#include <sys/types.h>
|
|
|
|
+#include <stdint.h>
|
|
#include <time.h>
|
|
#include <time.h>
|
|
|
|
|
|
#ifdef __cplusplus
|
|
#ifdef __cplusplus
|
|
@@ -32,22 +33,19 @@ extern "C" {
|
|
#define DST_TUR 9 /* Turkey */
|
|
#define DST_TUR 9 /* Turkey */
|
|
#define DST_AUSTALT 10 /* Australian style with shift in 1986 */
|
|
#define DST_AUSTALT 10 /* Australian style with shift in 1986 */
|
|
|
|
|
|
-struct timezone {
|
|
|
|
- int tz_minuteswest; /* minutes west of Greenwich */
|
|
|
|
- int tz_dsttime; /* type of dst correction */
|
|
|
|
|
|
+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,
|
|
* Structure returned by gettimeofday(2) system call,
|
|
* and used in other calls.
|
|
* and used in other calls.
|
|
*/
|
|
*/
|
|
#ifndef _TIMEVAL_DEFINED
|
|
#ifndef _TIMEVAL_DEFINED
|
|
#define _TIMEVAL_DEFINED
|
|
#define _TIMEVAL_DEFINED
|
|
-#if !(defined(_WIN32))
|
|
|
|
|
|
+#if !defined(_WIN32)
|
|
struct timeval
|
|
struct timeval
|
|
{
|
|
{
|
|
time_t tv_sec; /* seconds */
|
|
time_t tv_sec; /* seconds */
|
|
@@ -56,6 +54,16 @@ struct timeval
|
|
#endif
|
|
#endif
|
|
#endif /* _TIMEVAL_DEFINED */
|
|
#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
|
|
|
|
+
|
|
int stime(const time_t *t);
|
|
int stime(const time_t *t);
|
|
time_t timegm(struct tm * const t);
|
|
time_t timegm(struct tm * const t);
|
|
int gettimeofday(struct timeval *tv, struct timezone *tz);
|
|
int gettimeofday(struct timeval *tv, struct timezone *tz);
|
|
@@ -65,15 +73,6 @@ struct tm *gmtime_r(const time_t *timep, struct tm *r);
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#ifdef RT_USING_POSIX
|
|
#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 */
|
|
/* POSIX clock and timer */
|
|
#define MILLISECOND_PER_SECOND 1000UL
|
|
#define MILLISECOND_PER_SECOND 1000UL
|
|
#define MICROSECOND_PER_SECOND 1000000UL
|
|
#define MICROSECOND_PER_SECOND 1000000UL
|
|
@@ -106,6 +105,10 @@ int clock_settime (clockid_t clockid, const struct timespec *tp);
|
|
int rt_timespec_to_tick(const struct timespec *time);
|
|
int rt_timespec_to_tick(const struct timespec *time);
|
|
#endif /* RT_USING_POSIX */
|
|
#endif /* RT_USING_POSIX */
|
|
|
|
|
|
|
|
+void tz_set(int8_t tz);
|
|
|
|
+int8_t tz_get(void);
|
|
|
|
+int8_t tz_is_dst(void);
|
|
|
|
+
|
|
#ifdef __cplusplus
|
|
#ifdef __cplusplus
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|