]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/gps.cxx
Projection matrix and texture size should be coherent
[flightgear.git] / src / Instrumentation / gps.cxx
index 913aba769ad969de3ac368b9a1fa9f9f0316f7c3..2d448f575a94e833c409ce80247ef0c409c470bd 100644 (file)
@@ -11,9 +11,9 @@
 
 #include <simgear/compiler.h>
 #include <Aircraft/aircraft.hxx>
-#include "Main/fg_props.hxx"
-#include "Main/util.hxx" // for fgLowPass
-#include "Navaids/positioned.hxx"
+#include <Main/fg_props.hxx>
+#include <Main/util.hxx> // for fgLowPass
+#include <Navaids/positioned.hxx>
 
 #include <simgear/math/sg_random.h>
 #include <simgear/sg_inlines.h>
@@ -479,20 +479,14 @@ GPS::updateTTWNode(UpdateContext& ctx, double distance_m, SGPropertyNode_ptr nod
     if (ctx.speed_kt > 0.0 && distance_m > 0.0) {
         TTW = (distance_m * SG_METER_TO_NM) / (ctx.speed_kt / 3600);
     }
-   
-    unsigned int TTW_seconds = (int) (TTW + 0.5);
-    if (TTW_seconds < 356400) { // That's 99 hours
+    if (TTW < 356400.5) { // That's 99 hours
+      unsigned int TTW_seconds = (int) (TTW + 0.5);
       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);