summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/util.c b/util.c
index 47642e8..3edaa88 100644
--- a/util.c
+++ b/util.c
@@ -48,9 +48,11 @@ gint flx_timeval_compare(const GTimeVal *a, const GTimeVal *b) {
glong flx_timeval_diff(const GTimeVal *a, const GTimeVal *b) {
g_assert(a);
g_assert(b);
- g_assert(flx_timeval_compare(a, b) >= 0);
- return (a->tv_sec - b->tv_sec)*1000000 + a->tv_usec - b->tv_usec;
+ if (flx_timeval_compare(a, b) < 0)
+ return flx_timeval_diff(b, a);
+
+ return ((glong) a->tv_sec - b->tv_sec)*1000000 + a->tv_usec - b->tv_usec;
}