From cf3e5b8b28c44279208dc3ec258fd859d32adbcb Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Thu, 23 Oct 2008 08:39:13 +0000 Subject: 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 --- cpp/src/qpid/broker/RateTracker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cpp/src') 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); } -- cgit v1.2.1