From 435bb3443507dd224b3579dbb4ba5657dc5cc8fa Mon Sep 17 00:00:00 2001 From: jagannatharjun Date: Sun, 28 Mar 2021 19:45:06 +0530 Subject: [PATCH] Change clamping of update interval of SpeedPlotView::Averager Don't clamp elapsed time of SpeedPlotView::Averager on resolution. Since it may cause minor discrepencies across different Averagers with different resolution for same speed update. --- src/gui/properties/speedplotview.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/properties/speedplotview.cpp b/src/gui/properties/speedplotview.cpp index c4c3f6645..4628c43d6 100644 --- a/src/gui/properties/speedplotview.cpp +++ b/src/gui/properties/speedplotview.cpp @@ -120,8 +120,7 @@ bool SpeedPlotView::Averager::push(const SampleData &sampleData) // system may go to sleep, that can cause very big elapsed interval const milliseconds updateInterval {static_cast(BitTorrent::Session::instance()->refreshInterval() * 1.25)}; - const milliseconds maxElapsed {std::max(updateInterval, m_resolution)}; - const milliseconds elapsed {std::min(milliseconds {m_lastSampleTime.elapsed()}, maxElapsed)}; + const milliseconds elapsed {std::min(milliseconds {m_lastSampleTime.elapsed()}, updateInterval)}; if (elapsed < m_resolution) return false; // still accumulating