1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

added g_timeval_cmp()

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@904 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-11-30 23:12:42 +00:00 committed by cras
parent a01275959d
commit e7bfb7fe88
2 changed files with 12 additions and 0 deletions

View File

@ -94,6 +94,17 @@ int g_input_add(int source, int condition,
function, data); 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 get_timeval_diff(const GTimeVal *tv1, const GTimeVal *tv2)
{ {
long secs, usecs; long secs, usecs;

View File

@ -7,6 +7,7 @@
typedef void* (*FOREACH_FIND_FUNC) (void *item, void *data); 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); long get_timeval_diff(const GTimeVal *tv1, const GTimeVal *tv2);
/* find `item' from a space separated `list' */ /* find `item' from a space separated `list' */