7 #include <sys/select.h>
9 int gettimeofday (struct timeval *, void *);
11 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
12 || defined(_BSD_SOURCE)
15 #define ITIMER_VIRTUAL 1
20 struct timeval it_interval;
21 struct timeval it_value;
24 int getitimer (int, struct itimerval *);
25 int setitimer (int, const struct itimerval *, struct itimerval *);
26 int utimes (const char *, const struct timeval [2]);
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 *);
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--) )