type exposure fixes in sys/sem.h
[musl] / include / sys / time.h
1 #ifndef _SYS_TIME_H
2 #define _SYS_TIME_H
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
6
7 #include <sys/select.h>
8
9 int gettimeofday (struct timeval *, void *);
10
11 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
12  || defined(_BSD_SOURCE)
13
14 #define ITIMER_REAL    0
15 #define ITIMER_VIRTUAL 1
16 #define ITIMER_PROF    2
17
18 struct itimerval
19 {
20         struct timeval it_interval;
21         struct timeval it_value;
22 };
23
24 int getitimer (int, struct itimerval *);
25 int setitimer (int, const struct itimerval *, struct itimerval *);
26 int utimes (const char *, const struct timeval [2]);
27
28 #endif
29
30 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
31 int futimes(int, const struct timeval [2]);
32 int lutimes(const char *, const struct timeval [2]);
33 int settimeofday (const struct timeval *, void *);
34 int adjtime (const struct timeval *, struct timeval *);
35 struct timezone {
36         int tz_minuteswest;
37         int tz_dsttime;
38 };
39 #define timerisset(t) ((t)->tv_sec || (t)->tv_usec)
40 #define timerclear(t) ((t)->tv_sec = (t)->tv_usec = 0)
41 #define timercmp(s,t,op) ((s)->tv_sec == (t)->tv_sec ? \
42         (s)->tv_usec op (t)->tv_usec : (s)->tv_sec op (t)->tv_sec)
43 #define timeradd(s,t,a) ( (a)->tv_sec = (s)->tv_sec + (t)->tv_sec, \
44         ((a)->tv_usec = (s)->tv_usec + (t)->tv_usec) >= 1000000 && \
45         ((a)->tv_usec -= 1000000, (a)->tv_sec++) )
46 #define timersub(s,t,a) ( (a)->tv_sec = (s)->tv_sec - (t)->tv_sec, \
47         ((a)->tv_usec = (s)->tv_usec - (t)->tv_usec) < 0 && \
48         ((a)->tv_usec += 1000000, (a)->tv_sec--) )
49 #endif
50
51 #ifdef __cplusplus
52 }
53 #endif
54 #endif