diff options
Diffstat (limited to 'Uploader.cpp')
-rw-r--r-- | Uploader.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Uploader.cpp b/Uploader.cpp index f4c0b0d..21322f2 100644 --- a/Uploader.cpp +++ b/Uploader.cpp @@ -116,8 +116,12 @@ void Uploader::dataTransferProgress(qint64 done, qint64 total) { m_rateCalculator.updateTotalBytes(done); const double rate = m_rateCalculator.rate(25000); - const qint64 time = (total - done) / rate; + qint64 time; + if (done == total) + time = m_rateCalculator.elapsed(); + else + time = (total - done) / rate; if (rate < 0 || time < 0) return; - cerr << "\r\033[2K" << static_cast<qint64>(round(done / 1024.0)) << " of " << static_cast<qint64>(round(total / 1024.0)) << " kilobytes transferred at " << static_cast<qint64>(round(rate * 1024.0 / 1000.0)) << " kilobytes per second, " << time / 1000 / 60 << " minutes and " << time / 1000 % 60 << " seconds left."; + cerr << "\r\033[2K" << static_cast<qint64>(round(done / 1024.0)) << "/" << static_cast<qint64>(round(total / 1024.0)) << " kB | " << static_cast<qint64>(round(rate * 1024.0 / 1000.0)) << " kB/s | ETA: " << time / 1000 / 60 << ":" << time / 1000 % 60; } |