aboutsummaryrefslogtreecommitdiff
path: root/src/timer.c
diff options
context:
space:
mode:
authorkaustubhprabhu <devnull@localhost>2009-07-09 23:44:05 +0000
committerkaustubhprabhu <devnull@localhost>2009-07-09 23:44:05 +0000
commitf4ca73a1b12427d8ce598d4a2da216be51027090 (patch)
treef49a5301cf633f3d1997ffe95d66e9ad46b35ea5 /src/timer.c
parent71a7ccf6d3fd33a111c688fdf488a7eddf7fd5ac (diff)
downloadiperf3-f4ca73a1b12427d8ce598d4a2da216be51027090.tar.gz
added udp jitter/packet count calculation
Diffstat (limited to 'src/timer.c')
-rw-r--r--src/timer.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/timer.c b/src/timer.c
index 302016d..7f3dd0b 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -24,7 +24,8 @@ timeval_to_double(struct timeval *tv)
double
timeval_diff(struct timeval *tv0, struct timeval *tv1)
{
- return timeval_to_double(tv1) - timeval_to_double(tv0);
+ //return timeval_to_double(tv1) - timeval_to_double(tv0);
+ return (tv1->tv_sec - tv0->tv_sec) + abs(tv1->tv_usec - tv0->tv_usec) / 1000000.0;
}
int
@@ -43,7 +44,7 @@ timer_expired(struct timer *tp)
current+= now.tv_sec * 1000000 ;
current+= now.tv_usec;
- diff = end - current;
+ diff = end - current;
return diff <= 0;