Commit 0bf8310e authored by Dag Erling Smørgrav's avatar Dag Erling Smørgrav

gettimeofday() is good enough for varnishstat.


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@1715 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent f3b0d0ca
......@@ -32,6 +32,8 @@
* Log tailer for Varnish
*/
#include <sys/time.h>
#include <curses.h>
#include <errno.h>
#include <limits.h>
......@@ -42,10 +44,6 @@
#include <time.h>
#include <unistd.h>
#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());
......
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