From fb5844d2b352f01a718fae90a338a20fab64165f Mon Sep 17 00:00:00 2001 From: des Date: Thu, 19 Jul 2007 10:58:31 +0000 Subject: [PATCH] gettimeofday() is good enough for varnishstat. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1715 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishstat/varnishstat.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/varnish-cache/bin/varnishstat/varnishstat.c b/varnish-cache/bin/varnishstat/varnishstat.c index 622eb7d6..06b895c8 100644 --- a/varnish-cache/bin/varnishstat/varnishstat.c +++ b/varnish-cache/bin/varnishstat/varnishstat.c @@ -32,6 +32,8 @@ * Log tailer for Varnish */ +#include + #include #include #include @@ -42,10 +44,6 @@ #include #include -#ifndef HAVE_CLOCK_GETTIME -#include "compat/clock_gettime.h" -#endif - #include "libvarnish.h" #include "shmlog.h" #include "varnishapi.h" @@ -64,7 +62,7 @@ do_curses(struct varnish_stats *VSL_stats, int delay) { struct varnish_stats copy; intmax_t ju; - struct timespec ts; + struct timeval tv; double tt, lt, hit, miss, ratio, up; double a1, a2, a3; unsigned n1, n2, n3; @@ -86,11 +84,11 @@ do_curses(struct varnish_stats *VSL_stats, int delay) lt = 0; while (1) { - clock_gettime(CLOCK_REALTIME, &ts); - tt = ts.tv_nsec * 1e-9 + ts.tv_sec; + gettimeofday(&tv, NULL); + tt = tv.tv_usec * 1e-6 + tv.tv_sec; lt = tt - lt; - rt = ts.tv_sec - VSL_stats->start_time; + rt = tv.tv_sec - VSL_stats->start_time; up = rt; mvprintw(0, 0, "%*s", COLS - 1, VSL_Name()); -- 2.39.5