X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Ftop.c;h=750488948b1961ccba38cd0e8e047a4371c23c57;hp=8232c7a7d82fb13237190e1cc740c3a552d168b8;hb=6bc5d626a8726fc23365ee705761a3c666a08ad4;hpb=d30b9e1272fef18070d37d10b2b3e4bb2fc07f59 diff --git a/src/top.c b/src/top.c index 8232c7a7..75048894 100644 --- a/src/top.c +++ b/src/top.c @@ -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];