4 time_fix(struct timeval *tv)
6 while (tv->tv_usec >= 1000000) {
7 tv->tv_usec -= 1000000;
10 while (tv->tv_usec < 0) {
11 tv->tv_usec += 1000000;
17 time_add(struct timeval *tv, long microseconds)
19 tv->tv_usec += microseconds;
24 time_compare(struct timeval *a, struct timeval *b)
27 if ((r = a->tv_sec - b->tv_sec)) return r;
28 return a->tv_usec - b->tv_usec;
32 time_difference(struct timeval *a, struct timeval *b, struct timeval *r)
35 v.tv_sec = a->tv_sec - b->tv_sec;
36 v.tv_usec = a->tv_usec - b->tv_usec;