X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ftop.c;h=750488948b1961ccba38cd0e8e047a4371c23c57;hb=6bc5d626a8726fc23365ee705761a3c666a08ad4;hp=478e4fb9c59a88db6b74701f59a1b729c1c08d80;hpb=0b8b23e0dd7219344543f135ca0aeba8a4a42d48;p=tinc diff --git a/src/top.c b/src/top.c index 478e4fb9..75048894 100644 --- a/src/top.c +++ b/src/top.c @@ -1,6 +1,6 @@ /* top.c -- Show real-time statistics from a running tincd - Copyright (C) 2011 Guus Sliepen + Copyright (C) 2011-2012 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -57,7 +57,7 @@ static int sortmode = 0; static bool cumulative = false; static list_t node_list; -static struct timeval now, prev, diff; +static struct timeval cur, prev, diff; static int delay = 1000; static bool changed = true; static const char *unit = "bytes"; @@ -69,10 +69,10 @@ static float scale = 1; static void update(int fd) { sendline(fd, "%d %d", CONTROL, REQ_DUMP_TRAFFIC); - gettimeofday(&now, NULL); + gettimeofday(&cur, NULL); - timersub(&now, &prev, &diff); - prev = now; + timersub(&cur, &prev, &diff); + prev = cur; float interval = diff.tv_sec + diff.tv_usec * 1e-6; char line[4096]; @@ -156,7 +156,7 @@ static void redraw(void) { for(int i = 0; i < n; i++) sorted[i]->i = i; - + int cmpfloat(float a, float b) { if(a < b) return -1;