summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-11-30 23:12:42 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-11-30 23:12:42 +0000
commite7bfb7fe88bdab5e0d68a1a1036f5cb32306a311 (patch)
tree8ac7072d323dce44dfe78b6d772298c808d8e507 /src
parenta01275959deb5c8936bf90a3c51e4f9771a59819 (diff)
downloadirssi-e7bfb7fe88bdab5e0d68a1a1036f5cb32306a311.zip
added g_timeval_cmp()
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@904 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/core/misc.c11
-rw-r--r--src/core/misc.h1
2 files changed, 12 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;
diff --git a/src/core/misc.h b/src/core/misc.h
index 2bcdb67c..176c7a3d 100644
--- a/src/core/misc.h
+++ b/src/core/misc.h
@@ -7,6 +7,7 @@
typedef void* (*FOREACH_FIND_FUNC) (void *item, void *data);
+int g_timeval_cmp(const GTimeVal *tv1, const GTimeVal *tv2);
long get_timeval_diff(const GTimeVal *tv1, const GTimeVal *tv2);
/* find `item' from a space separated `list' */