use symlink rather than bogus linker script for libc.so
[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 #endif
27
28 #include <bits/alltypes.h>
29
30 struct tm
31 {
32         int tm_sec;
33         int tm_min;
34         int tm_hour;
35         int tm_mday;
36         int tm_mon;
37         int tm_year;
38         int tm_wday;
39         int tm_yday;
40         int tm_isdst;
41         long __tm_gmtoff;
42         const char *__tm_zone;
43 };
44
45 clock_t clock (void);
46 time_t time (time_t *);
47 double difftime (time_t, time_t);
48 time_t mktime (struct tm *);
49 size_t strftime (char *, size_t, const char *, const struct tm *);
50 struct tm *gmtime (const time_t *);
51 struct tm *localtime (const time_t *);
52 char *asctime (const struct tm *);
53 char *ctime (const time_t *);
54
55 #define CLOCKS_PER_SEC 1000000UL
56
57
58 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
59  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
60
61 struct tm *gmtime_r (const time_t *, struct tm *);
62 struct tm *localtime_r (const time_t *, struct tm *);
63 char *asctime_r (const struct tm *, char *);
64 char *ctime_r (const time_t *, char *);
65
66 void tzset (void);
67
68 struct itimerspec
69 {
70         struct timespec it_interval;
71         struct timespec it_value;
72 };
73
74 #define CLOCK_REALTIME           0
75 #define CLOCK_MONOTONIC          1
76 #define CLOCK_PROCESS_CPUTIME_ID 2
77 #define CLOCK_THREAD_CPUTIME_ID  3
78
79 #define TIMER_ABSTIME 1
80
81 int nanosleep (const struct timespec *, struct timespec *);
82 int clock_getres (clockid_t, struct timespec *);
83 int clock_gettime (clockid_t, struct timespec *);
84 int clock_settime (clockid_t, const struct timespec *);
85 int clock_nanosleep (clockid_t, int, const struct timespec *, struct timespec *);
86 int clock_getcpuclockid (pid_t, clockid_t *);
87
88 /* FIXME..?? */
89 struct sigevent;
90 int timer_create (clockid_t, struct sigevent *, timer_t *);
91 int timer_delete (timer_t);
92 int timer_settime (timer_t, int, const struct itimerspec *, struct itimerspec *);
93 int timer_gettime (timer_t, struct itimerspec *);
94 int timer_getoverrun (timer_t);
95
96 #endif
97
98
99 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
100 char *strptime (const char *, const char *, struct tm *);
101 extern int daylight;
102 extern long timezone;
103 extern char *tzname[2];
104 extern int getdate_err;
105 extern struct tm *getdate (const char *);
106 #endif
107
108
109 #ifdef __cplusplus
110 }
111 #endif
112
113
114 #endif