summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2005-01-21 00:16:08 +0000
committerLennart Poettering <lennart@poettering.net>2005-01-21 00:16:08 +0000
commit0781d5363fb6fd723a2316fc7558aef6439b2f71 (patch)
treef6a942889c55230611d4472c21a7075a7c2fc609 /util.c
parentd6e2dbabccb08970da991e6d2b0fda7a56d83e6f (diff)
massive work
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@8 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'util.c')
-rw-r--r--util.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/util.c b/util.c
index 334a799..62574ba 100644
--- a/util.c
+++ b/util.c
@@ -24,3 +24,29 @@ gchar *flx_normalize_name(const gchar *s) {
return g_strdup_printf("%s.", s);
}
+gint flx_timeval_compare(const GTimeVal *a, const GTimeVal *b) {
+ g_assert(a);
+ g_assert(b);
+
+ if (a->tv_sec < b->tv_sec)
+ return -1;
+
+ if (a->tv_sec > b->tv_sec)
+ return 1;
+
+ if (a->tv_usec < b->tv_usec)
+ return -1;
+
+ if (a->tv_usec > b->tv_usec)
+ return 1;
+
+ return 0;
+}
+
+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;
+}