From 41959d4d543332d8d068650d3a48ff7e0cf962ee Mon Sep 17 00:00:00 2001 From: James Crook Date: Wed, 29 Aug 2018 15:14:28 +0100 Subject: [PATCH] Bug 1952 - Windows: Timer Record - debug failure msg Now we show "11:07:29 +" for a time 100 years, 11 hours, 7 mins and 29 seconds in the future, rather than ASSERTing. The + should probably be mentioned in the manual. "In the countdown, times more than 24 hours ahead aren't shown fully. A '+' sign after the time indicates that it is more than a day ahead." --- src/widgets/ProgressDialog.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/widgets/ProgressDialog.cpp b/src/widgets/ProgressDialog.cpp index e7384545f..cbcf991e2 100644 --- a/src/widgets/ProgressDialog.cpp +++ b/src/widgets/ProgressDialog.cpp @@ -1696,14 +1696,20 @@ ProgressResult TimerProgressDialog::UpdateProgress() // Only update if a full second has passed. if (now - mLastUpdate > 1000) { + // Bug 1952: + // wxTimeSpan will assert on ridiculously large values. + // We silently wrap the displayed range at one day. + // You'll only see the remaining hours, mins and secs. + // With a + sign, if the time was wrapped. + const wxLongLong_t wrapTime = 24 * 60 * 60 * 1000; if (m_bShowElapsedTime) { - wxTimeSpan tsElapsed(0, 0, 0, elapsed); - mElapsed->SetLabel(tsElapsed.Format(wxT("%H:%M:%S"))); + wxTimeSpan tsElapsed(0, 0, 0, elapsed % wrapTime); + mElapsed->SetLabel(tsElapsed.Format(wxT("%H:%M:%S")) + ((elapsed >= wrapTime) ? " +":"")); mElapsed->Update(); } - wxTimeSpan tsRemains(0, 0, 0, remains); - mRemaining->SetLabel(tsRemains.Format(wxT("%H:%M:%S"))); + wxTimeSpan tsRemains(0, 0, 0, remains % wrapTime); + mRemaining->SetLabel(tsRemains.Format(wxT("%H:%M:%S")) + ((remains >= wrapTime) ? " +":"")); mRemaining->Update(); mLastUpdate = now;