]> err.no Git - varnish/commitdiff
Replace Uptime() with TIM_mono()
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 12 Jul 2007 09:25:45 +0000 (09:25 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 12 Jul 2007 09:25:45 +0000 (09:25 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1670 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_backend.c

index fce74820b31fd5278e85d9cd6c2e212f48796c0a..0e92976299bbefec01686c4e92418a5deb2d5b27 100644 (file)
 #include <sys/select.h>
 #include <sys/ioctl.h>
 
-#ifndef HAVE_CLOCK_GETTIME
-#include "compat/clock_gettime.h"
-#endif
-
 #include "heritage.h"
 #include "shmlog.h"
 #include "cache.h"
@@ -63,18 +59,6 @@ static TAILQ_HEAD(,bereq) bereq_head = TAILQ_HEAD_INITIALIZER(bereq_head);
 
 static MTX vbemtx;
 
-/*--------------------------------------------------------------------*/
-/* XXX: belongs a more general place */
-
-static double
-Uptime(void)
-{
-       struct timespec ts;
-
-       assert(clock_gettime(CLOCK_MONOTONIC, &ts) == 0);
-       return (ts.tv_sec + ts.tv_nsec * 1e-9);
-}
-
 /*--------------------------------------------------------------------*/
 
 struct bereq *
@@ -153,7 +137,7 @@ vbe_lookup(struct backend *bp)
        error = getaddrinfo(bp->hostname,
            bp->portname == NULL ? "http" : bp->portname,
            &hint, &res);
-       bp->dnstime = Uptime();
+       bp->dnstime = TIM_mono();
        if (error) {
                if (res != NULL)
                        freeaddrinfo(res);
@@ -207,7 +191,7 @@ vbe_conn_try(struct backend *bp, struct addrinfo **pai)
                }
        }
 
-       if (bp->dnstime + bp->dnsttl >= Uptime())
+       if (bp->dnstime + bp->dnsttl >= TIM_mono())
                return (-1);
 
        /* Then do another lookup to catch DNS changes */