r1669 - trunk/varnish-cache/bin/varnishd

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


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

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


Modified: trunk/varnish-cache/bin/varnishd/mgt_event.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_event.c	2007-07-12 09:04:54 UTC (rev 1668)
+++ trunk/varnish-cache/bin/varnishd/mgt_event.c	2007-07-12 09:25:07 UTC (rev 1669)
@@ -37,10 +37,6 @@
 #include <string.h>
 #include <stdlib.h>
 
-#ifndef HAVE_CLOCK_GETTIME
-#include "compat/clock_gettime.h"
-#endif
-
 #include "mgt.h"
 #include "mgt_event.h"
 #include "miniobj.h"
@@ -76,19 +72,6 @@
 
 /*--------------------------------------------------------------------*/
 
-static double
-ev_now(void)
-{
-	double t;
-	struct timespec ts;
-
-	assert(clock_gettime(CLOCK_MONOTONIC, &ts) == 0);
-	t = ts.tv_sec + ts.tv_nsec * 1e-9;
-	return (t);
-}
-
-/*--------------------------------------------------------------------*/
-
 static void
 ev_bh_update(void *priv, void *a, unsigned u)
 {
@@ -265,7 +248,7 @@
 	e->magic = EV_MAGIC;	/* before binheap_insert() */
 
 	if (e->timeout != 0.0) {
-		e->__when += ev_now() + e->timeout;
+		e->__when += TIM_mono() + e->timeout;
 		binheap_insert(evb->binheap, e);
 		assert(e->__binheap_idx > 0);
 	} else {
@@ -430,7 +413,7 @@
 	if (e != NULL) {
 		CHECK_OBJ_NOTNULL(e, EV_MAGIC);
 		assert(e->__binheap_idx == 1);
-		t = ev_now();
+		t = TIM_mono();
 		if (e->__when <= t)
 			return (ev_sched_timeout(evb, e, t));
 		tmo = (int)((e->__when - t) * 1e3);
@@ -453,7 +436,7 @@
 		return (ev_sched_signal(evb));
 	if (i == 0) {
 		assert(e != NULL);
-		t = ev_now();
+		t = TIM_mono();
 		if (e->__when <= t)
 			return (ev_sched_timeout(evb, e, t));
 	}




More information about the varnish-commit mailing list