From 0b9e224be98b31b3f87475fe224167c9672949a6 Mon Sep 17 00:00:00 2001 From: jmt Date: Sat, 3 Jan 2009 17:58:01 +0000 Subject: [PATCH] Patch from Ron Jensen: make the TTW computation marginally less silly. --- src/Instrumentation/gps.cxx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/Instrumentation/gps.cxx b/src/Instrumentation/gps.cxx index 913aba769..424ed3e90 100644 --- a/src/Instrumentation/gps.cxx +++ b/src/Instrumentation/gps.cxx @@ -485,14 +485,9 @@ GPS::updateTTWNode(UpdateContext& ctx, double distance_m, SGPropertyNode_ptr nod unsigned int TTW_minutes = 0; unsigned int TTW_hours = 0; char TTW_str[9]; - while (TTW_seconds >= 3600) { - TTW_seconds -= 3600; - TTW_hours++; - } - while (TTW_seconds >= 60) { - TTW_seconds -= 60; - TTW_minutes++; - } + TTW_hours = TTW_seconds / 3600; + TTW_minutes = (TTW_seconds / 60) % 60; + TTW_seconds = TTW_seconds % 60; snprintf(TTW_str, 9, "%02d:%02d:%02d", TTW_hours, TTW_minutes, TTW_seconds); node->setStringValue(TTW_str);