diff options
Diffstat (limited to 'libglusterfs/src')
-rw-r--r-- | libglusterfs/src/libglusterfs.sym | 2 | ||||
-rw-r--r-- | libglusterfs/src/timespec.c | 16 | ||||
-rw-r--r-- | libglusterfs/src/timespec.h | 2 |
3 files changed, 20 insertions, 0 deletions
diff --git a/libglusterfs/src/libglusterfs.sym b/libglusterfs/src/libglusterfs.sym index 27eb1175b56..c8c42311c80 100644 --- a/libglusterfs/src/libglusterfs.sym +++ b/libglusterfs/src/libglusterfs.sym @@ -1057,6 +1057,8 @@ tbf_init tbf_throttle timespec_now timespec_sub +timespec_adjust_delta +timespec_cmp token_iter_init trap trie_add diff --git a/libglusterfs/src/timespec.c b/libglusterfs/src/timespec.c index d17506662ac..c0d4ab9315b 100644 --- a/libglusterfs/src/timespec.c +++ b/libglusterfs/src/timespec.c @@ -90,3 +90,19 @@ timespec_sub(const struct timespec *begin, const struct timespec *end, res->tv_nsec = end->tv_nsec - begin->tv_nsec; } } + +int +timespec_cmp(const struct timespec *lhs_ts, const struct timespec *rhs_ts) +{ + if (lhs_ts->tv_sec < rhs_ts->tv_sec) { + return -1; + } else if (lhs_ts->tv_sec > rhs_ts->tv_sec) { + return 1; + } else if (lhs_ts->tv_nsec < rhs_ts->tv_nsec) { + return -1; + } else if (lhs_ts->tv_nsec > rhs_ts->tv_nsec) { + return 1; + } + + return 0; +} diff --git a/libglusterfs/src/timespec.h b/libglusterfs/src/timespec.h index 73db2d16abe..871871d538c 100644 --- a/libglusterfs/src/timespec.h +++ b/libglusterfs/src/timespec.h @@ -25,5 +25,7 @@ timespec_adjust_delta(struct timespec *ts, struct timespec delta); void timespec_sub(const struct timespec *begin, const struct timespec *end, struct timespec *res); +int +timespec_cmp(const struct timespec *lhs_ts, const struct timespec *rhs_ts); #endif /* __INCLUDE_TIMESPEC_H__ */ |