fix constraint violation in ftw
[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 #if __STDC_VERSION__ >= 199901L
8 #define __restrict restrict
9 #elif !defined(__GNUC__)
10 #define __restrict
11 #endif
12
13 #include <sys/select.h>
14
15 int gettimeofday (struct timeval *__restrict, void *__restrict);
16
17 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
18  || defined(_BSD_SOURCE)
19
20 #define ITIMER_REAL    0
21 #define ITIMER_VIRTUAL 1
22 #define ITIMER_PROF    2
23
24 struct itimerval
25 {
26         struct timeval it_interval;
27         struct timeval it_value;
28 };
29
30 int getitimer (int, struct itimerval *);
31 int setitimer (int, const struct itimerval *__restrict, struct itimerval *__restrict);
32 int utimes (const char *, const struct timeval [2]);
33
34 #endif
35
36 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
37 int futimes(int, const struct timeval [2]);
38 int lutimes(const char *, const struct timeval [2]);
39 int settimeofday (const struct timeval *, void *);
40 int adjtime (const struct timeval *, struct timeval *);
41 struct timezone {
42         int tz_minuteswest;
43         int tz_dsttime;
44 };
45 #define timerisset(t) ((t)->tv_sec || (t)->tv_usec)
46 #define timerclear(t) ((t)->tv_sec = (t)->tv_usec = 0)
47 #define timercmp(s,t,op) ((s)->tv_sec == (t)->tv_sec ? \
48         (s)->tv_usec op (t)->tv_usec : (s)->tv_sec op (t)->tv_sec)
49 #define timeradd(s,t,a) ( (a)->tv_sec = (s)->tv_sec + (t)->tv_sec, \
50         ((a)->tv_usec = (s)->tv_usec + (t)->tv_usec) >= 1000000 && \
51         ((a)->tv_usec -= 1000000, (a)->tv_sec++) )
52 #define timersub(s,t,a) ( (a)->tv_sec = (s)->tv_sec - (t)->tv_sec, \
53         ((a)->tv_usec = (s)->tv_usec - (t)->tv_usec) < 0 && \
54         ((a)->tv_usec += 1000000, (a)->tv_sec--) )
55 #endif
56
57 #ifdef __cplusplus
58 }
59 #endif
60 #endif