From be420b2cc26ff2c0e2fd342bda00ad274bafe4b0 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 31 May 2012 23:47:20 +0200 Subject: Don't print garbage time values to console. --- Uploader.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Uploader.cpp b/Uploader.cpp index 94610cb..f4c0b0d 100644 --- a/Uploader.cpp +++ b/Uploader.cpp @@ -117,5 +117,7 @@ void Uploader::dataTransferProgress(qint64 done, qint64 total) m_rateCalculator.updateTotalBytes(done); const double rate = m_rateCalculator.rate(25000); const qint64 time = (total - done) / rate; + if (rate < 0 || time < 0) + return; cerr << "\r\033[2K" << static_cast(round(done / 1024.0)) << " of " << static_cast(round(total / 1024.0)) << " kilobytes transferred at " << static_cast(round(rate * 1024.0 / 1000.0)) << " kilobytes per second, " << time / 1000 / 60 << " minutes and " << time / 1000 % 60 << " seconds left."; } -- cgit v1.2.3-59-g8ed1b