summaryrefslogtreecommitdiff
path: root/src/core/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/misc.c')
-rw-r--r--src/core/misc.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/misc.c b/src/core/misc.c
index 37e6a001..938f2a40 100644
--- a/src/core/misc.c
+++ b/src/core/misc.c
@@ -94,6 +94,17 @@ int g_input_add(int source, int condition,
function, data);
}
+int g_timeval_cmp(const GTimeVal *tv1, const GTimeVal *tv2)
+{
+ if (tv1->tv_sec < tv2->tv_sec)
+ return -1;
+ if (tv1->tv_sec > tv2->tv_sec)
+ return 1;
+
+ return tv1->tv_usec < tv2->tv_usec ? -1 :
+ tv1->tv_usec > tv2->tv_usec ? 1 : 0;
+}
+
long get_timeval_diff(const GTimeVal *tv1, const GTimeVal *tv2)
{
long secs, usecs;