7 #include <sys/select.h>
9 int gettimeofday (struct timeval *, void *);
11 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
14 #define ITIMER_VIRTUAL 1
19 struct timeval it_interval;
20 struct timeval it_value;
23 int getitimer (int, struct itimerval *);
24 int setitimer (int, const struct itimerval *, struct itimerval *);
25 int utimes (const char *, const struct timeval [2]);
30 int settimeofday (const struct timeval *, void *);
31 int adjtime (const struct timeval *, struct timeval *);
36 #define timerisset(t) ((t)->tv_sec || (t)->tv_usec)
37 #define timerclear(t) ((t)->tv_sec = (t)->tv_usec = 0)
38 #define timercmp(s,t,op) ((s)->tv_sec == (t)->tv_sec ? \
39 (s)->tv_usec op (t)->tv_usec : (s)->tv_sec op (t)->tv_sec)
40 #define timeradd(s,t,a) ( (a)->tv_sec = (s)->tv_sec + (t)->tv_sec, \
41 ((a)->tv_usec = (s)->tv_usec + (t)->tv_usec) >= 1000000 && \
42 ((a)->tv_usec -= 1000000, (a)->tv_sec++) )
43 #define timersub(s,t,a) ( (a)->tv_sec = (s)->tv_sec - (t)->tv_sec, \
44 ((a)->tv_usec = (s)->tv_usec - (t)->tv_usec) < 0 && \
45 ((a)->tv_usec += 1000000, (a)->tv_sec--) )