1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-08 16:11:14 +02:00

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."
This commit is contained in:
James Crook 2018-08-29 15:14:28 +01:00
parent b5f9acefa4
commit 41959d4d54

View File

@ -1696,14 +1696,20 @@ ProgressResult TimerProgressDialog::UpdateProgress()
// Only update if a full second has passed. // Only update if a full second has passed.
if (now - mLastUpdate > 1000) 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) { if (m_bShowElapsedTime) {
wxTimeSpan tsElapsed(0, 0, 0, elapsed); wxTimeSpan tsElapsed(0, 0, 0, elapsed % wrapTime);
mElapsed->SetLabel(tsElapsed.Format(wxT("%H:%M:%S"))); mElapsed->SetLabel(tsElapsed.Format(wxT("%H:%M:%S")) + ((elapsed >= wrapTime) ? " +":""));
mElapsed->Update(); mElapsed->Update();
} }
wxTimeSpan tsRemains(0, 0, 0, remains); wxTimeSpan tsRemains(0, 0, 0, remains % wrapTime);
mRemaining->SetLabel(tsRemains.Format(wxT("%H:%M:%S"))); mRemaining->SetLabel(tsRemains.Format(wxT("%H:%M:%S")) + ((remains >= wrapTime) ? " +":""));
mRemaining->Update(); mRemaining->Update();
mLastUpdate = now; mLastUpdate = now;