#include <string.h>
-#include "util.h"
+#include "timeval.h"
#include "cache.h"
#include "log.h"
usec = ((AvahiUsec) e->record->ttl) * 10000;
/* 2% jitter */
- usec = (AvahiUsec) g_random_double_range(usec*percent, usec*(percent+2));
+ usec = (AvahiUsec) g_random_double_range((gdouble) (usec*percent), (gdouble) (usec*(percent+2)));
/* g_message("next expiry: %lli (%s)", usec / 1000000, txt = avahi_record_to_string(e->record)); */
/* g_free(txt); */
g_assert(e);
e->state = AVAHI_CACHE_FINAL;
- g_get_current_time(&e->expiry);
+ gettimeofday(&e->expiry, NULL);
avahi_timeval_add(&e->expiry, 1000000); /* 1s */
update_time_event(c, e);
}
} else {
AvahiCacheEntry *e = NULL, *first;
- GTimeVal now;
+ struct timeval now;
- g_get_current_time(&now);
+ gettimeofday(&now, NULL);
/* This is an update request */
}
gboolean avahi_cache_entry_half_ttl(AvahiCache *c, AvahiCacheEntry *e) {
- GTimeVal now;
+ struct timeval now;
AvahiUsec age;
g_assert(c);
g_assert(e);
- g_get_current_time(&now);
+ gettimeofday(&now, NULL);
age = avahi_timeval_diff(&now, &e->timestamp)/1000000;