OLD | NEW |
1 #ifndef»_TIME_H | 1 #ifndef _TIME_H |
2 #define _TIME_H | 2 #define _TIME_H |
3 | 3 |
4 #ifdef __cplusplus | 4 #ifdef __cplusplus |
5 extern "C" { | 5 extern "C" { |
6 #endif | 6 #endif |
7 | 7 |
8 #include <features.h> | 8 #include <features.h> |
9 | 9 |
10 #ifdef __cplusplus | 10 #ifdef __cplusplus |
11 #define NULL 0L | 11 #define NULL 0L |
12 #else | 12 #else |
13 #define NULL ((void*)0) | 13 #define NULL ((void*)0) |
14 #endif | 14 #endif |
15 | 15 |
16 | |
17 #define __NEED_size_t | 16 #define __NEED_size_t |
18 #define __NEED_time_t | 17 #define __NEED_time_t |
19 #define __NEED_clock_t | 18 #define __NEED_clock_t |
20 #define __NEED_struct_timespec | 19 #define __NEED_struct_timespec |
21 | 20 |
22 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ | 21 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || \ |
23 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ | 22 defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) |
24 || defined(_BSD_SOURCE) | |
25 #define __NEED_clockid_t | 23 #define __NEED_clockid_t |
26 #define __NEED_timer_t | 24 #define __NEED_timer_t |
27 #define __NEED_pid_t | 25 #define __NEED_pid_t |
28 #define __NEED_locale_t | 26 #define __NEED_locale_t |
29 #endif | 27 #endif |
30 | 28 |
31 #include <bits/alltypes.h> | 29 #include <bits/alltypes.h> |
32 | 30 |
33 #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) | 31 #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) |
34 #define __tm_gmtoff tm_gmtoff | 32 #define __tm_gmtoff tm_gmtoff |
35 #define __tm_zone tm_zone | 33 #define __tm_zone tm_zone |
36 #endif | 34 #endif |
37 | 35 |
38 struct tm | 36 struct tm { |
39 { | 37 int tm_sec; |
40 » int tm_sec; | 38 int tm_min; |
41 » int tm_min; | 39 int tm_hour; |
42 » int tm_hour; | 40 int tm_mday; |
43 » int tm_mday; | 41 int tm_mon; |
44 » int tm_mon; | 42 int tm_year; |
45 » int tm_year; | 43 int tm_wday; |
46 » int tm_wday; | 44 int tm_yday; |
47 » int tm_yday; | 45 int tm_isdst; |
48 » int tm_isdst; | 46 long __tm_gmtoff; |
49 » long __tm_gmtoff; | 47 const char* __tm_zone; |
50 » const char *__tm_zone; | |
51 }; | 48 }; |
52 | 49 |
53 clock_t clock (void); | 50 clock_t clock(void); |
54 time_t time (time_t *); | 51 time_t time(time_t*); |
55 double difftime (time_t, time_t); | 52 double difftime(time_t, time_t); |
56 time_t mktime (struct tm *); | 53 time_t mktime(struct tm*); |
57 size_t strftime (char *__restrict, size_t, const char *__restrict, const struct
tm *__restrict); | 54 size_t strftime(char* __restrict, |
58 struct tm *gmtime (const time_t *); | 55 size_t, |
59 struct tm *localtime (const time_t *); | 56 const char* __restrict, |
60 char *asctime (const struct tm *); | 57 const struct tm* __restrict); |
61 char *ctime (const time_t *); | 58 struct tm* gmtime(const time_t*); |
62 int timespec_get(struct timespec *, int); | 59 struct tm* localtime(const time_t*); |
| 60 char* asctime(const struct tm*); |
| 61 char* ctime(const time_t*); |
| 62 int timespec_get(struct timespec*, int); |
63 | 63 |
64 #define CLOCKS_PER_SEC 1000000L | 64 #define CLOCKS_PER_SEC 1000000L |
65 | 65 |
66 #define TIME_UTC 1 | 66 #define TIME_UTC 1 |
67 | 67 |
68 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ | 68 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || \ |
69 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ | 69 defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) |
70 || defined(_BSD_SOURCE) | |
71 | 70 |
72 size_t strftime_l (char * __restrict, size_t, const char * __restrict, const s
truct tm * __restrict, locale_t); | 71 size_t strftime_l(char* __restrict, |
| 72 size_t, |
| 73 const char* __restrict, |
| 74 const struct tm* __restrict, |
| 75 locale_t); |
73 | 76 |
74 struct tm *gmtime_r (const time_t *__restrict, struct tm *__restrict); | 77 struct tm* gmtime_r(const time_t* __restrict, struct tm* __restrict); |
75 struct tm *localtime_r (const time_t *__restrict, struct tm *__restrict); | 78 struct tm* localtime_r(const time_t* __restrict, struct tm* __restrict); |
76 char *asctime_r (const struct tm *__restrict, char *__restrict); | 79 char* asctime_r(const struct tm* __restrict, char* __restrict); |
77 char *ctime_r (const time_t *, char *); | 80 char* ctime_r(const time_t*, char*); |
78 | 81 |
79 void tzset (void); | 82 void tzset(void); |
80 | 83 |
81 struct itimerspec | 84 struct itimerspec { |
82 { | 85 struct timespec it_interval; |
83 » struct timespec it_interval; | 86 struct timespec it_value; |
84 » struct timespec it_value; | |
85 }; | 87 }; |
86 | 88 |
87 #define CLOCK_REALTIME 0 | 89 #define CLOCK_REALTIME 0 |
88 #define CLOCK_MONOTONIC 1 | 90 #define CLOCK_MONOTONIC 1 |
89 #define CLOCK_PROCESS_CPUTIME_ID 2 | 91 #define CLOCK_PROCESS_CPUTIME_ID 2 |
90 #define CLOCK_THREAD_CPUTIME_ID 3 | 92 #define CLOCK_THREAD_CPUTIME_ID 3 |
91 #define CLOCK_MONOTONIC_RAW 4 | 93 #define CLOCK_MONOTONIC_RAW 4 |
92 #define CLOCK_REALTIME_COARSE 5 | 94 #define CLOCK_REALTIME_COARSE 5 |
93 #define CLOCK_MONOTONIC_COARSE 6 | 95 #define CLOCK_MONOTONIC_COARSE 6 |
94 #define CLOCK_BOOTTIME 7 | 96 #define CLOCK_BOOTTIME 7 |
95 #define CLOCK_REALTIME_ALARM 8 | 97 #define CLOCK_REALTIME_ALARM 8 |
96 #define CLOCK_BOOTTIME_ALARM 9 | 98 #define CLOCK_BOOTTIME_ALARM 9 |
97 #define CLOCK_SGI_CYCLE 10 | 99 #define CLOCK_SGI_CYCLE 10 |
98 #define CLOCK_TAI 11 | 100 #define CLOCK_TAI 11 |
99 | 101 |
100 #define TIMER_ABSTIME 1 | 102 #define TIMER_ABSTIME 1 |
101 | 103 |
102 int nanosleep (const struct timespec *, struct timespec *); | 104 int nanosleep(const struct timespec*, struct timespec*); |
103 int clock_getres (clockid_t, struct timespec *); | 105 int clock_getres(clockid_t, struct timespec*); |
104 int clock_gettime (clockid_t, struct timespec *); | 106 int clock_gettime(clockid_t, struct timespec*); |
105 int clock_settime (clockid_t, const struct timespec *); | 107 int clock_settime(clockid_t, const struct timespec*); |
106 int clock_nanosleep (clockid_t, int, const struct timespec *, struct timespec *)
; | 108 int clock_nanosleep(clockid_t, int, const struct timespec*, struct timespec*); |
107 int clock_getcpuclockid (pid_t, clockid_t *); | 109 int clock_getcpuclockid(pid_t, clockid_t*); |
108 | 110 |
109 struct sigevent; | 111 struct sigevent; |
110 int timer_create (clockid_t, struct sigevent *__restrict, timer_t *__restrict); | 112 int timer_create(clockid_t, struct sigevent* __restrict, timer_t* __restrict); |
111 int timer_delete (timer_t); | 113 int timer_delete(timer_t); |
112 int timer_settime (timer_t, int, const struct itimerspec *__restrict, struct iti
merspec *__restrict); | 114 int timer_settime(timer_t, |
113 int timer_gettime (timer_t, struct itimerspec *); | 115 int, |
114 int timer_getoverrun (timer_t); | 116 const struct itimerspec* __restrict, |
| 117 struct itimerspec* __restrict); |
| 118 int timer_gettime(timer_t, struct itimerspec*); |
| 119 int timer_getoverrun(timer_t); |
115 | 120 |
116 #endif | 121 #endif |
117 | 122 |
118 | |
119 #if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE) | 123 #if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE) |
120 char *strptime (const char *__restrict, const char *__restrict, struct tm *__res
trict); | 124 char* strptime(const char* __restrict, |
| 125 const char* __restrict, |
| 126 struct tm* __restrict); |
121 extern int daylight; | 127 extern int daylight; |
122 extern long timezone; | 128 extern long timezone; |
123 extern char *tzname[2]; | 129 extern char* tzname[2]; |
124 extern int getdate_err; | 130 extern int getdate_err; |
125 struct tm *getdate (const char *); | 131 struct tm* getdate(const char*); |
126 #endif | 132 #endif |
127 | 133 |
128 | |
129 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) | 134 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) |
130 int stime(const time_t *); | 135 int stime(const time_t*); |
131 time_t timegm(struct tm *); | 136 time_t timegm(struct tm*); |
132 #endif | 137 #endif |
133 | 138 |
134 #ifdef __cplusplus | 139 #ifdef __cplusplus |
135 } | 140 } |
136 #endif | 141 #endif |
137 | 142 |
138 | |
139 #endif | 143 #endif |
OLD | NEW |