1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
#ifndef _TIME_H
#define _TIME_H
#include <bits/null.h>
#include <bits/size_t.h>
#include <bits/ansi/time_t.h>
#include <bits/ansi/timespec.h>
#include <mlibc-config.h>
// [7.27.1] Components of time
#define CLOCKS_PER_SEC ((clock_t)1000000)
#define TIME_UTC 1
// POSIX extensions.
#define CLOCK_REALTIME 0
#define CLOCK_MONOTONIC 1
#define CLOCK_PROCESS_CPUTIME_ID 2
#define CLOCK_THREAD_CPUTIME_ID 3
#define CLOCK_MONOTONIC_RAW 4
#define CLOCK_REALTIME_COARSE 5
#define CLOCK_MONOTONIC_COARSE 6
#define CLOCK_BOOTTIME 7
#define CLOCK_REALTIME_ALARM 8
#define CLOCK_BOOTTIME_ALARM 9
#ifdef __cplusplus
extern "C" {
#endif
// [7.27.1] Components of time
typedef long clock_t; // Matches Linux' ABI.
struct tm {
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
long int tm_gmtoff;
const char *tm_zone;
};
#ifndef __MLIBC_ABI_ONLY
// [7.27.2] Time manipulation functions
clock_t clock(void);
double difftime(time_t a, time_t b);
time_t mktime(struct tm *ptr);
time_t time(time_t *timer);
int timespec_get(struct timespec *ptr, int base);
// [7.27.3] Time conversion functions
char *asctime(const struct tm *ptr);
char *ctime(const time_t *timer);
struct tm *gmtime(const time_t *timer);
struct tm *gmtime_r(const time_t *__restrict timer, struct tm *__restrict result);
struct tm *localtime(const time_t *timer);
size_t strftime(char *__restrict dest, size_t max_size,
const char *__restrict format, const struct tm *__restrict ptr);
void tzset(void);
#endif /* !__MLIBC_ABI_ONLY */
#ifdef __cplusplus
}
#endif
// POSIX extensions.
#if __MLIBC_POSIX_OPTION
# include <bits/posix/posix_time.h>
# include <bits/posix/timer_t.h>
#endif // __MLIBC_POSIX_OPTION
#include <abi-bits/clockid_t.h>
#define TIMER_ABSTIME 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __MLIBC_ABI_ONLY
extern int daylight;
extern long timezone;
extern char *tzname[2];
int nanosleep(const struct timespec *, struct timespec *);
int clock_getres(clockid_t, struct timespec *);
int clock_gettime(clockid_t, struct timespec *);
int clock_nanosleep(clockid_t, int, const struct timespec *, struct timespec *);
int clock_settime(clockid_t, const struct timespec *);
struct tm *localtime_r(const time_t *, struct tm *);
char *asctime_r(const struct tm *tm, char *buf);
char *ctime_r(const time_t *, char *);
#if __MLIBC_POSIX_OPTION
char *strptime(const char *__restrict, const char *__restrict,
struct tm *__restrict);
#endif /* __MLIBC_POSIX_OPTION */
#endif /* !__MLIBC_ABI_ONLY */
#ifdef __cplusplus
}
#endif
// GNU extensions.
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __MLIBC_ABI_ONLY
time_t timelocal(struct tm *);
time_t timegm(struct tm *);
#endif /* !__MLIBC_ABI_ONLY */
#ifdef __cplusplus
}
#endif
// Linux extensions.
#ifdef __cplusplus
extern "C" {
#endif
struct itimerspec {
struct timespec it_interval;
struct timespec it_value;
};
#ifdef __cplusplus
}
#endif
#endif // _TIME_H
|