|
|
|
@ -235,14 +235,18 @@ INLINE void timeval_add(struct timeval *result, const struct timeval *a, const s
|
|
|
|
INLINE void timeval_add_usec(struct timeval *tv, long usec) {
|
|
|
|
INLINE void timeval_add_usec(struct timeval *tv, long usec) {
|
|
|
|
timeval_from_us(tv, timeval_us(tv) + usec);
|
|
|
|
timeval_from_us(tv, timeval_us(tv) + usec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
INLINE int timeval_cmp(const struct timeval *a, const struct timeval *b) {
|
|
|
|
INLINE int long_cmp(long long a, long long b) {
|
|
|
|
long long diff;
|
|
|
|
if (a == b)
|
|
|
|
diff = timeval_diff(a, b);
|
|
|
|
return 0;
|
|
|
|
if (diff < 0)
|
|
|
|
if (a < b)
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
if (diff > 0)
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
INLINE int timeval_cmp(const struct timeval *a, const struct timeval *b) {
|
|
|
|
|
|
|
|
int r = long_cmp(a->tv_sec, b->tv_sec);
|
|
|
|
|
|
|
|
if (r != 0)
|
|
|
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
return long_cmp(a->tv_usec, b->tv_usec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// as a GCompareFunc
|
|
|
|
// as a GCompareFunc
|
|
|
|
int timeval_cmp_ptr(const void *a, const void *b);
|
|
|
|
int timeval_cmp_ptr(const void *a, const void *b);
|
|
|
|
|