From f47c3003a79f3c0a00ca82f12101ff62b28db2b6 Mon Sep 17 00:00:00 2001 From: ericchristoffersen <46055145+ericchristoffersen@users.noreply.github.com> Date: Thu, 12 Nov 2020 16:49:32 -0800 Subject: [PATCH] Fix 3498 - truncate distances for display (#3663) For distance display, better to truncate than to round up. --- src/Train/DialWindow.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Train/DialWindow.cpp b/src/Train/DialWindow.cpp index a54a47b1e..3753e3eb0 100644 --- a/src/Train/DialWindow.cpp +++ b/src/Train/DialWindow.cpp @@ -253,7 +253,11 @@ DialWindow::telemetryUpdate(const RealtimeData &rtData) case RealtimeData::Distance: case RealtimeData::LapDistance: + case RealtimeData::RouteDistance: if (!GlobalContext::context()->useMetricUnits) value *= MILES_PER_KM; + // Default floating point rounds to nearest. For distance we'd like to not see the + // next biggest number until we're actually there... Truncate to meter. + value = ((double)((unsigned)(value * 1000.))) / 1000.; valueLabel->setText(QString("%1").arg(value, 0, 'f', 3)); break;