[master] cf00dd2ed VTIM usage polish

Poul-Henning Kamp phk at FreeBSD.org
Wed Oct 13 07:32:07 UTC 2021


commit cf00dd2ed96c9b7a2ccd02846d9bc55719b9b919
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Oct 13 07:31:09 2021 +0000

    VTIM usage polish

diff --git a/bin/varnishd/cache/cache_lck.c b/bin/varnishd/cache/cache_lck.c
index a41b9a93e..aeb228e46 100644
--- a/bin/varnishd/cache/cache_lck.c
+++ b/bin/varnishd/cache/cache_lck.c
@@ -228,7 +228,6 @@ Lck_CondWaitUntil(pthread_cond_t *cond, struct lock *lck, vtim_real when)
 {
 	struct ilck *ilck;
 	struct timespec ts;
-	vtim_real t;
 
 	AN(lck);
 	CAST_OBJ_NOTNULL(ilck, lck->priv, ILCK_MAGIC);
@@ -240,8 +239,7 @@ Lck_CondWaitUntil(pthread_cond_t *cond, struct lock *lck, vtim_real when)
 		AZ(errno);
 	} else {
 		assert(when > 1e9);
-		ts.tv_nsec = (long)(modf(when, &t) * 1e9);
-		ts.tv_sec = (long)t;
+		ts = VTIM_timespec(when);
 		assert(ts.tv_nsec >= 0 && ts.tv_nsec <= 999999999);
 		errno = pthread_cond_timedwait(cond, &ilck->mtx, &ts);
 #if defined (__APPLE__)
diff --git a/bin/varnishd/http2/cache_http2_session.c b/bin/varnishd/http2/cache_http2_session.c
index 889441a4c..b260ffc59 100644
--- a/bin/varnishd/http2/cache_http2_session.c
+++ b/bin/varnishd/http2/cache_http2_session.c
@@ -39,7 +39,6 @@
 #include "http2/cache_http2.h"
 
 #include "vend.h"
-#include "vtim.h"
 #include "vtcp.h"
 
 static const char h2_resp_101[] =


More information about the varnish-commit mailing list