+ if ((ret = avahi_timeval_compare(&a->expiry, &b->expiry)) != 0)
+ return ret;
+
+ /* If both exevents are scheduled for the same time, put the entry
+ * that has been run earlier the last time first. */
+ return avahi_timeval_compare(&a->last_run, &b->last_run);
+}
+
+static void source_get_timeval(GSource *source, struct timeval *tv) {
+ GTimeVal gtv;
+
+ g_assert(source);
+ g_assert(tv);
+
+ g_source_get_current_time(source, >v);
+ tv->tv_sec = gtv.tv_sec;
+ tv->tv_usec = gtv.tv_usec;