]> git.mxchange.org Git - flightgear.git/commitdiff
Catch a possible NAN at insanely low but greater than zero speeds
authortorsten <torsten>
Tue, 22 Sep 2009 14:22:49 +0000 (14:22 +0000)
committerTim Moore <timoore@redhat.com>
Tue, 22 Sep 2009 20:48:14 +0000 (22:48 +0200)
src/Instrumentation/gps.cxx

index 2d448f575a94e833c409ce80247ef0c409c470bd..e2b451467c03d6061d83e542711880f8f93dddf6 100644 (file)
@@ -476,8 +476,9 @@ GPS::updateTTWNode(UpdateContext& ctx, double distance_m, SGPropertyNode_ptr nod
     // increase. Makes most sense when travelling directly towards
     // the waypoint.
     double TTW = 0.0;
-    if (ctx.speed_kt > 0.0 && distance_m > 0.0) {
-        TTW = (distance_m * SG_METER_TO_NM) / (ctx.speed_kt / 3600);
+    double speed_nm_per_second = ctx.speed_kt / 3600;
+    if (speed_nm_per_second > SGLimitsd::min() && distance_m > 0.0) {
+        TTW = (distance_m * SG_METER_TO_NM) / speed_nm_per_second;
     }
     if (TTW < 356400.5) { // That's 99 hours
       unsigned int TTW_seconds = (int) (TTW + 0.5);