]> git.mxchange.org Git - flightgear.git/commitdiff
Time initialization fixes. 1) Offset types "system-offset", "gmt-offset",
authordurk <durk>
Sun, 9 Jul 2006 08:02:47 +0000 (08:02 +0000)
committerdurk <durk>
Sun, 9 Jul 2006 08:02:47 +0000 (08:02 +0000)
and "latitude-offset" should not use a precalculated value of warp.
2) Since the values of cur_time and crrGMT are identical in the current
version of the SGTime class, the calculations of the "system", "gmt", and
"latitude" are re-evaluated and updated where necessary.

src/Main/fg_init.cxx

index ed50f01b7a8943cced4502ef4f3758655aa364b1..49e1ced0de771fbea58e045fe98b9b1b1449cd0f 100644 (file)
@@ -1417,7 +1417,7 @@ void fgInitTimeOffset() {
     time_t systemLocalTime = sgTimeGetGMT( localtime(&cur_time) );
     time_t aircraftLocalTime = 
         sgTimeGetGMT( fgLocaltime(&cur_time, t->get_zonename() ) );
-
+    
     // Okay, we now have several possible scenarios
     int offset = fgGetInt("/sim/startup/time-offset");
     string offset_type = fgGetString("/sim/startup/time-offset-type");
@@ -1476,16 +1476,19 @@ void fgInitTimeOffset() {
                                            180.0, false ); 
     } else if ( offset_type == "system-offset" ) {
         warp = offset;
+       orig_warp = 0;
     } else if ( offset_type == "gmt-offset" ) {
         warp = offset - (currGMT - systemLocalTime);
+       orig_warp = 0;
     } else if ( offset_type == "latitude-offset" ) {
         warp = offset - (aircraftLocalTime - systemLocalTime);
+       orig_warp = 0;
     } else if ( offset_type == "system" ) {
-        warp = offset - cur_time;
+      warp = offset - (systemLocalTime - currGMT) - cur_time;
     } else if ( offset_type == "gmt" ) {
-        warp = offset - currGMT;
+        warp = offset - cur_time;
     } else if ( offset_type == "latitude" ) {
-        warp = offset - (aircraftLocalTime - systemLocalTime) - cur_time; 
+        warp = offset - (aircraftLocalTime - currGMT)- cur_time; 
     } else {
         SG_LOG( SG_GENERAL, SG_ALERT,
                 "FG_TIME::Unsupported offset type " << offset_type );