]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: cache - use clock_boottime_or_monotonic()
authorTom Gundersen <teg@jklm.no>
Tue, 28 Jul 2015 00:45:04 +0000 (02:45 +0200)
committerTom Gundersen <teg@jklm.no>
Mon, 3 Aug 2015 11:42:44 +0000 (13:42 +0200)
We cannot rely on CLOCK_BOOTTIME being supported by the kernel, so fallack
to CLOCK_MONOTONIC if the former is not supported.

src/resolve/resolved-dns-cache.c

index be5289168125700b7db1650be29943f2cab83ea0..9ffaf4b19f21169cf99d9e94b3987b7f3d2547b7 100644 (file)
@@ -152,7 +152,7 @@ void dns_cache_prune(DnsCache *c) {
                         break;
 
                 if (t <= 0)
-                        t = now(CLOCK_BOOTTIME);
+                        t = now(clock_boottime_or_monotonic());
 
                 if (i->until > t)
                         break;
@@ -406,7 +406,7 @@ int dns_cache_put(
         dns_cache_make_space(c, answer->n_rrs + q->n_keys);
 
         if (timestamp <= 0)
-                timestamp = now(CLOCK_BOOTTIME);
+                timestamp = now(clock_boottime_or_monotonic());
 
         /* Second, add in positive entries for all contained RRs */
         for (i = 0; i < MIN(max_rrs, answer->n_rrs); i++) {