Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion ping.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,16 @@
Enhancements and fixes by Georgi Kolev:
-> http://github.com/jedie/python-ping/

Bug fix by Andrejs Rozitis:
-> http://github.com/rozitis/python-ping/

Revision history
~~~~~~~~~~~~~~~~

March 19, 2013
--------------
* Fixing bug to prevent divide by 0 during run-time.

January 26, 2012
----------------
* Fixing BUG #4 - competability with python 2.x [tested with 2.7]
Expand Down Expand Up @@ -516,7 +523,8 @@ def quiet_ping(hostname, timeout = 3000, count = 3,

if myStats.pktsSent > 0:
myStats.fracLoss = (myStats.pktsSent - myStats.pktsRcvd)/myStats.pktsSent
myStats.avrgTime = myStats.totTime / myStats.pktsRcvd
if myStats.pktsRcvd > 0:
myStats.avrgTime = myStats.totTime / myStats.pktsRcvd

# return tuple(max_rtt, min_rtt, avrg_rtt, percent_lost)
return myStats.maxTime, myStats.minTime, myStats.avrgTime, myStats.fracLoss
Expand Down