X-Git-Url: http://git.openwrt.org/?p=project%2Fmdnsd.git;a=blobdiff_plain;f=util.c;h=63f1612fdb2c935887de2d0bdd2953ae5d630a40;hp=e68e9c9f5f0e27cbbc2f02382698475bb867dff0;hb=0d545ed7287026584722a3f9aa855c29bd24d59f;hpb=d654808ff33c54f587c5fee79be84ac20794db55 diff --git a/util.c b/util.c index e68e9c9..63f1612 100644 --- a/util.c +++ b/util.c @@ -16,8 +16,6 @@ #include #include #include -#include -#include #include #include @@ -29,6 +27,7 @@ #include #include +#include #include "dns.h" #include "util.h" @@ -76,13 +75,9 @@ void get_hostname(void) snprintf(mdns_hostname_local, sizeof(mdns_hostname_local), "%s.local", utsname.nodename); } -void* -memdup(const void *d, int l) +time_t monotonic_time(void) { - void *r = malloc(l); - if (!r) - return NULL; - memcpy(r, d, l); - return r; + struct timespec ts; + clock_gettime(CLOCK_MONOTONIC, &ts); + return ts.tv_sec; } -