r1670 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Thu Jul 12 11:25:46 CEST 2007


Author: phk
Date: 2007-07-12 11:25:45 +0200 (Thu, 12 Jul 2007)
New Revision: 1670

Modified:
   trunk/varnish-cache/bin/varnishd/cache_backend.c
Log:
Replace Uptime() with TIM_mono()


Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend.c	2007-07-12 09:25:07 UTC (rev 1669)
+++ trunk/varnish-cache/bin/varnishd/cache_backend.c	2007-07-12 09:25:45 UTC (rev 1670)
@@ -48,10 +48,6 @@
 #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"
@@ -64,19 +60,7 @@
 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 *
 vbe_new_bereq(void)
 {
@@ -153,7 +137,7 @@
 	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 @@
 		}
 	}
 
-	if (bp->dnstime + bp->dnsttl >= Uptime())
+	if (bp->dnstime + bp->dnsttl >= TIM_mono())
 		return (-1);
 
 	/* Then do another lookup to catch DNS changes */




More information about the varnish-commit mailing list