Use monotonic clock for timeouts
[project/mdnsd.git] / util.c
diff --git a/util.c b/util.c
index f0517b4..d3d4d55 100644 (file)
--- a/util.c
+++ b/util.c
@@ -73,3 +73,10 @@ void get_hostname(void)
        snprintf(mdns_hostname, sizeof(mdns_hostname), "%s", utsname.nodename);
        snprintf(mdns_hostname_local, sizeof(mdns_hostname_local), "%s.local", utsname.nodename);
 }
+
+time_t monotonic_time(void)
+{
+       struct timespec ts;
+       clock_gettime(CLOCK_MONOTONIC, &ts);
+       return ts.tv_sec;
+}