[Pkg-bitcoin-commits] [bitcoin] 29/126: Fix division by zero in time remaining
Jonas Smedegaard
dr at jones.dk
Mon Nov 13 20:01:02 UTC 2017
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag debian/0.15.1_dfsg-1
in repository bitcoin.
commit 2e31b1d48d4da31bf32e1e4123c7e5d662490826
Author: MeshCollider <dobsonsa68 at gmail.com>
Date: Wed Sep 6 10:49:36 2017 +1200
Fix division by zero in time remaining
Github-Pull: #11237
Rebased-From: 3b69a08c53c2ef738f32c270fdacf1e4ed5a4c97
---
src/qt/modaloverlay.cpp | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/qt/modaloverlay.cpp b/src/qt/modaloverlay.cpp
index a83f285..4f357e2 100644
--- a/src/qt/modaloverlay.cpp
+++ b/src/qt/modaloverlay.cpp
@@ -99,15 +99,18 @@ void ModalOverlay::tipUpdate(int count, const QDateTime& blockDate, double nVeri
progressDelta = progressStart-sample.second;
timeDelta = blockProcessTime[0].first - sample.first;
progressPerHour = progressDelta/(double)timeDelta*1000*3600;
- remainingMSecs = remainingProgress / progressDelta * timeDelta;
+ remainingMSecs = (progressDelta > 0) ? remainingProgress / progressDelta * timeDelta : -1;
break;
}
}
// show progress increase per hour
ui->progressIncreasePerH->setText(QString::number(progressPerHour*100, 'f', 2)+"%");
- // show expected remaining time
- ui->expectedTimeLeft->setText(GUIUtil::formatNiceTimeOffset(remainingMSecs/1000.0));
+ if(remainingMSecs >= 0) {
+ ui->expectedTimeLeft->setText(GUIUtil::formatNiceTimeOffset(remainingMSecs / 1000.0));
+ } else {
+ ui->expectedTimeLeft->setText(QObject::tr("unknown"));
+ }
static const int MAX_SAMPLES = 5000;
if (blockProcessTime.count() > MAX_SAMPLES)
@@ -169,4 +172,4 @@ void ModalOverlay::closeClicked()
{
showHide(true);
userClosed = true;
-}
+}
\ No newline at end of file
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-bitcoin/bitcoin.git
More information about the Pkg-bitcoin-commits
mailing list