1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-11 15:27:54 +00:00

Merge pull request #2059 from sorokin/fix-eta

Fix ETA calculation
This commit is contained in:
sledgehammer999 2014-11-02 15:41:40 +02:00
commit 08de7f7439

View File

@ -29,8 +29,6 @@
*/ */
#include <QList> #include <QList>
#include <QDateTime>
#include <vector>
#include "qbtsession.h" #include "qbtsession.h"
#include "misc.h" #include "misc.h"
@ -141,6 +139,10 @@ qlonglong TorrentSpeedMonitor::getETA(const QString &hash, const libtorrent::tor
void TorrentSpeedMonitor::statsReceived(const stats_alert &stats) void TorrentSpeedMonitor::statsReceived(const stats_alert &stats)
{ {
m_samples[misc::toQString(stats.handle.info_hash())].addSample(stats.transferred[stats_alert::download_payload] * 1000 / stats.interval, Q_ASSERT(stats.interval >= 1000);
stats.transferred[stats_alert::upload_payload] * 1000 / stats.interval);
int speedDL = static_cast<int>(static_cast<long long>(stats.transferred[stats_alert::download_payload]) * 1000 / stats.interval);
int speedUL = static_cast<int>(static_cast<long long>(stats.transferred[stats_alert::upload_payload]) * 1000 / stats.interval);
m_samples[misc::toQString(stats.handle.info_hash())].addSample(speedDL, speedUL);
} }