Ping statistics total time is incorrect
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
iputils (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Hi,
Total ping time is not correct :
# ping -c 3 -i 2 IP
PING IP (IP) 56(84) bytes of data.
64 bytes from IP: icmp_seq=1 ttl=252 time=1.43 ms
64 bytes from IP: icmp_seq=2 ttl=252 time=0.686 ms
64 bytes from IP: icmp_seq=3 ttl=252 time=0.725 ms
--- IP ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 4000ms
This should report :
time in ms for first ping answer
+
2000 ms wait time
+
time in ms for second ping answer
+
2000 ms wait time
+
time in ms for third ping answer
So in the example I give, this should report 4002,841ms or 4003 ms (rounded up).
This reports 4000 ms or sometime 4001 ms or 4002 ms, but never the exact total I wrote above.
Leaving -i to default (1) has the same behavior.
Using -c 1 should make the total = time for icmp_seq=1, but :
# ping -c 1 IP
PING IP (IP) 56(84) bytes of data.
64 bytes from IP: icmp_seq=1 ttl=252 time=1.39 ms
--- IP ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
There must be a int() somewhere that don't coun't decimals ?
This is revelant as I use this for a ttl ping script and need to extract the total ping time ( = total displayed ping time - ( ( paquet count - 1 ) * interval ) )
# lsb_release -rd
Description: Ubuntu 10.04.1 LTS
Release: 10.04
# apt-cache policy iputils-ping
iputils-ping:
Installed: 3:20071127-2ubuntu1
Candidate: 3:20071127-2ubuntu1
Version table:
*** 3:20071127-2ubuntu1 0
500 http://
100 /var/lib/
Another example :
# time ping IP -t 2 -c 3 -i 2
PING IP (IP) 56(84) bytes of data.
From IP icmp_seq=1 Time to live exceeded
From IP icmp_seq=2 Time to live exceeded
From IP icmp_seq=3 Time to live exceeded
--- IP ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3999ms
real 0m4.001s
user 0m0.010s
sys 0m0.000s