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

Use TIM_real() or the benefit of OS/X.

Fixes	#640



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4532 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 66b6a77d
......@@ -35,6 +35,7 @@ SVNID("$Id$")
#include <string.h>
#include <ctype.h>
#include <fcntl.h>
#include <math.h>
#include <pthread.h>
#include <stdarg.h>
#include <stdlib.h>
......@@ -491,7 +492,7 @@ exec_file_thread(void *priv)
static double
exec_file(const char *fn, unsigned dur)
{
double t0;
double t0, t;
struct priv_exec pe;
pthread_t pt;
struct timespec ts;
......@@ -509,8 +510,9 @@ exec_file(const char *fn, unsigned dur)
fn, strerror(errno));
pe.fn = fn;
AZ(clock_gettime(CLOCK_REALTIME, &ts));
ts.tv_sec += dur;
t = TIM_real() + dur;
ts.tv_sec = floor(t);
ts.tv_nsec = (t - ts.tv_sec) * 1e9;
AZ(pthread_mutex_lock(&vtc_mtx));
AZ(pthread_create(&pt, NULL, exec_file_thread, &pe));
......
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