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