summaryrefslogtreecommitdiff
path: root/qpid/cpp/src
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2008-10-23 08:39:13 +0000
committerGordon Sim <gsim@apache.org>2008-10-23 08:39:13 +0000
commiteb06a138be6fc3139ad28789763d9b7ea5991bf1 (patch)
treef58ad6b7ef597a666b98dd534e8edf66ba67a28b /qpid/cpp/src
parent6e6674c08ba4d73ae161016cde2aae16f5b4d392 (diff)
downloadqpid-python-eb06a138be6fc3139ad28789763d9b7ea5991bf1.tar.gz
More complete fix to prevention of divide by zero when the sampling rate is more frequent than once per second.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@707311 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
-rw-r--r--qpid/cpp/src/qpid/broker/RateTracker.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/qpid/cpp/src/qpid/broker/RateTracker.cpp b/qpid/cpp/src/qpid/broker/RateTracker.cpp
index f7bf0a8ff0..fc88d99cfa 100644
--- a/qpid/cpp/src/qpid/broker/RateTracker.cpp
+++ b/qpid/cpp/src/qpid/broker/RateTracker.cpp
@@ -43,7 +43,7 @@ double RateTracker::sampleRatePerSecond()
lastCount = currentCount;
lastTime = now;
//if sampling at higher frequency than supported, will just return the number of increments
- if (interval == 0) return increment;
+ if (interval < TIME_SEC) return increment;
else if (increment == 0) return 0;
else return increment / (interval / TIME_SEC);
}