Commit a14fbe9f authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Replace Uptime() with TIM_mono()


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@1670 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent cfb91d5d
...@@ -48,10 +48,6 @@ ...@@ -48,10 +48,6 @@
#include <sys/select.h> #include <sys/select.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#ifndef HAVE_CLOCK_GETTIME
#include "compat/clock_gettime.h"
#endif
#include "heritage.h" #include "heritage.h"
#include "shmlog.h" #include "shmlog.h"
#include "cache.h" #include "cache.h"
...@@ -63,18 +59,6 @@ static TAILQ_HEAD(,bereq) bereq_head = TAILQ_HEAD_INITIALIZER(bereq_head); ...@@ -63,18 +59,6 @@ static TAILQ_HEAD(,bereq) bereq_head = TAILQ_HEAD_INITIALIZER(bereq_head);
static MTX vbemtx; 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 * struct bereq *
...@@ -153,7 +137,7 @@ vbe_lookup(struct backend *bp) ...@@ -153,7 +137,7 @@ vbe_lookup(struct backend *bp)
error = getaddrinfo(bp->hostname, error = getaddrinfo(bp->hostname,
bp->portname == NULL ? "http" : bp->portname, bp->portname == NULL ? "http" : bp->portname,
&hint, &res); &hint, &res);
bp->dnstime = Uptime(); bp->dnstime = TIM_mono();
if (error) { if (error) {
if (res != NULL) if (res != NULL)
freeaddrinfo(res); freeaddrinfo(res);
...@@ -207,7 +191,7 @@ vbe_conn_try(struct backend *bp, struct addrinfo **pai) ...@@ -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); return (-1);
/* Then do another lookup to catch DNS changes */ /* Then do another lookup to catch DNS changes */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment