[6.0] d4a8fd371 Polish
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Wed Oct 31 13:08:28 UTC 2018
commit d4a8fd3716e8f474f2bb7580be72a359fb5ea045
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date: Fri Oct 5 14:07:03 2018 +0100
Polish
diff --git a/configure.ac b/configure.ac
index 468e1cfd2..13b54b5fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -355,7 +355,6 @@ AC_CHECK_FUNCS([clock_gettime])
AC_CHECK_FUNCS([gethrtime])
LIBS="${save_LIBS}"
-AC_DEFINE([USE_GETHRTIME], [1], [whether to use gethrtime])
if test "x$ac_cv_func_gethrtime" = xyes && \
test "x$ac_cv_func_clock_gettime" = xyes ; then
AC_MSG_CHECKING(if clock_gettime is faster than gethrtime)
@@ -405,9 +404,9 @@ static hrtime_t cl()
return (1);
]])],
[AC_MSG_RESULT(yes)
- AC_DEFINE([USE_GETHRTIME], [0], [whether to use gethrtime])
],
[AC_MSG_RESULT(no)
+ AC_DEFINE([USE_GETHRTIME], [1], [Define if gethrtime is preferred])
]
)
fi
diff --git a/lib/libvarnish/vtim.c b/lib/libvarnish/vtim.c
index 39d5ca342..5c6503c7e 100644
--- a/lib/libvarnish/vtim.c
+++ b/lib/libvarnish/vtim.c
@@ -127,14 +127,14 @@ init(void)
double
VTIM_mono(void)
{
-#if defined(HAVE_GETHRTIME) && USE_GETHRTIME
- return (gethrtime() * 1e-9);
-#elif HAVE_CLOCK_GETTIME
+#if defined(HAVE_CLOCK_GETTIME) && !defined(USE_GETHRTIME)
struct timespec ts;
AZ(clock_gettime(CLOCK_MONOTONIC, &ts));
return (ts.tv_sec + 1e-9 * ts.tv_nsec);
-#elif defined(__MACH__)
+#elif defined(HAVE_GETHRTIME)
+ return (gethrtime() * 1e-9);
+#elif defined(__MACH__)
uint64_t mt = mach_absolute_time() - mt_base;
return (mt * mt_scale);
More information about the varnish-commit
mailing list