From: jmt Date: Sat, 3 Jan 2009 17:58:01 +0000 (+0000) Subject: Patch from Ron Jensen: make the TTW computation marginally less silly. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0b9e224be98b31b3f87475fe224167c9672949a6;p=flightgear.git Patch from Ron Jensen: make the TTW computation marginally less silly. --- 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);