From f1ad97534ce56a44b71fb03b72795e8f22c6cb3e Mon Sep 17 00:00:00 2001 From: phk Date: Thu, 12 Jul 2007 09:25:45 +0000 Subject: [PATCH] Replace Uptime() with TIM_mono() git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1670 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_backend.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache_backend.c b/varnish-cache/bin/varnishd/cache_backend.c index fce74820..0e929762 100644 --- a/varnish-cache/bin/varnishd/cache_backend.c +++ b/varnish-cache/bin/varnishd/cache_backend.c @@ -48,10 +48,6 @@ #include #include -#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 */ -- 2.39.5