10 #if __cplusplus >= 201103L
12 #elif defined(__cplusplus)
15 #define NULL ((void*)0)
21 #define __NEED_clock_t
22 #define __NEED_struct_timespec
24 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
25 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
26 || defined(_BSD_SOURCE)
27 #define __NEED_clockid_t
28 #define __NEED_timer_t
30 #define __NEED_locale_t
33 #include <bits/alltypes.h>
35 #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
36 #define __tm_gmtoff tm_gmtoff
37 #define __tm_zone tm_zone
51 const char *__tm_zone;
55 time_t time (time_t *);
56 double difftime (time_t, time_t);
57 time_t mktime (struct tm *);
58 size_t strftime (char *__restrict, size_t, const char *__restrict, const struct tm *__restrict);
59 struct tm *gmtime (const time_t *);
60 struct tm *localtime (const time_t *);
61 char *asctime (const struct tm *);
62 char *ctime (const time_t *);
63 int timespec_get(struct timespec *, int);
65 #define CLOCKS_PER_SEC 1000000L
69 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
70 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
71 || defined(_BSD_SOURCE)
73 size_t strftime_l (char * __restrict, size_t, const char * __restrict, const struct tm * __restrict, locale_t);
75 struct tm *gmtime_r (const time_t *__restrict, struct tm *__restrict);
76 struct tm *localtime_r (const time_t *__restrict, struct tm *__restrict);
77 char *asctime_r (const struct tm *__restrict, char *__restrict);
78 char *ctime_r (const time_t *, char *);
83 struct timespec it_interval;
84 struct timespec it_value;
87 #define CLOCK_REALTIME 0
88 #define CLOCK_MONOTONIC 1
89 #define CLOCK_PROCESS_CPUTIME_ID 2
90 #define CLOCK_THREAD_CPUTIME_ID 3
91 #define CLOCK_MONOTONIC_RAW 4
92 #define CLOCK_REALTIME_COARSE 5
93 #define CLOCK_MONOTONIC_COARSE 6
94 #define CLOCK_BOOTTIME 7
95 #define CLOCK_REALTIME_ALARM 8
96 #define CLOCK_BOOTTIME_ALARM 9
97 #define CLOCK_SGI_CYCLE 10
100 #define TIMER_ABSTIME 1
102 int nanosleep (const struct timespec *, struct timespec *);
103 int clock_getres (clockid_t, struct timespec *);
104 int clock_gettime (clockid_t, struct timespec *);
105 int clock_settime (clockid_t, const struct timespec *);
106 int clock_nanosleep (clockid_t, int, const struct timespec *, struct timespec *);
107 int clock_getcpuclockid (pid_t, clockid_t *);
110 int timer_create (clockid_t, struct sigevent *__restrict, timer_t *__restrict);
111 int timer_delete (timer_t);
112 int timer_settime (timer_t, int, const struct itimerspec *__restrict, struct itimerspec *__restrict);
113 int timer_gettime (timer_t, struct itimerspec *);
114 int timer_getoverrun (timer_t);
116 extern char *tzname[2];
121 #if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
122 char *strptime (const char *__restrict, const char *__restrict, struct tm *__restrict);
124 extern long timezone;
125 extern int getdate_err;
126 struct tm *getdate (const char *);
130 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
131 int stime(const time_t *);
132 time_t timegm(struct tm *);
136 __REDIR(time, __time64);
137 __REDIR(difftime, __difftime64);
138 __REDIR(mktime, __mktime64);
139 __REDIR(gmtime, __gmtime64);
140 __REDIR(localtime, __localtime64);
141 __REDIR(ctime, __ctime64);
142 __REDIR(timespec_get, __timespec_get_time64);
143 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
144 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
145 || defined(_BSD_SOURCE)
146 __REDIR(gmtime_r, __gmtime64_r);
147 __REDIR(localtime_r, __localtime64_r);
148 __REDIR(ctime_r, __ctime64_r);
149 __REDIR(nanosleep, __nanosleep_time64);
150 __REDIR(clock_getres, __clock_getres_time64);
151 __REDIR(clock_gettime, __clock_gettime64);
152 __REDIR(clock_settime, __clock_settime64);
153 __REDIR(clock_nanosleep, __clock_nanosleep_time64);
154 __REDIR(timer_settime, __timer_settime64);
155 __REDIR(timer_gettime, __timer_gettime64);
157 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
158 __REDIR(stime, __stime64);
159 __REDIR(timegm, __timegm_time64);