9 #include <sys/select.h>
11 int gettimeofday (struct timeval *__restrict, void *__restrict);
13 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
14 || defined(_BSD_SOURCE)
17 #define ITIMER_VIRTUAL 1
22 struct timeval it_interval;
23 struct timeval it_value;
26 int getitimer (int, struct itimerval *);
27 int setitimer (int, const struct itimerval *__restrict, struct itimerval *__restrict);
28 int utimes (const char *, const struct timeval [2]);
32 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
37 int futimes(int, const struct timeval [2]);
38 int futimesat(int, const char *, const struct timeval [2]);
39 int lutimes(const char *, const struct timeval [2]);
40 int settimeofday(const struct timeval *, const struct timezone *);
41 int adjtime (const struct timeval *, struct timeval *);
42 #define timerisset(t) ((t)->tv_sec || (t)->tv_usec)
43 #define timerclear(t) ((t)->tv_sec = (t)->tv_usec = 0)
44 #define timercmp(s,t,op) ((s)->tv_sec == (t)->tv_sec ? \
45 (s)->tv_usec op (t)->tv_usec : (s)->tv_sec op (t)->tv_sec)
46 #define timeradd(s,t,a) ( (a)->tv_sec = (s)->tv_sec + (t)->tv_sec, \
47 ((a)->tv_usec = (s)->tv_usec + (t)->tv_usec) >= 1000000 && \
48 ((a)->tv_usec -= 1000000, (a)->tv_sec++) )
49 #define timersub(s,t,a) ( (a)->tv_sec = (s)->tv_sec - (t)->tv_sec, \
50 ((a)->tv_usec = (s)->tv_usec - (t)->tv_usec) < 0 && \
51 ((a)->tv_usec += 1000000, (a)->tv_sec--) )