mirror of
https://github.com/c0re100/qBittorrent-Enhanced-Edition.git
synced 2025-01-09 04:18:39 +08:00
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.
This commit is contained in:
parent
bb39a41e9e
commit
435bb34435
@ -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<int64_t>(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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user