summaryrefslogtreecommitdiff
path: root/cpp
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
commitcf3e5b8b28c44279208dc3ec258fd859d32adbcb (patch)
treee34e9dbfc2f9aa02f425270c9320e5e892e4943d /cpp
parentf8d8aad20fdaefb83f009f2ec8a0c2e1e25c790e (diff)
downloadqpid-python-cf3e5b8b28c44279208dc3ec258fd859d32adbcb.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/qpid@707311 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/qpid/broker/RateTracker.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/cpp/src/qpid/broker/RateTracker.cpp b/cpp/src/qpid/broker/RateTracker.cpp
index f7bf0a8ff0..fc88d99cfa 100644
--- a/cpp/src/qpid/broker/RateTracker.cpp
+++ b/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);
}