From d68723f3da15cdad2f7dae6d6e1a5e0f8656656e Mon Sep 17 00:00:00 2001 From: durk <durk> Date: Sun, 9 Jul 2006 08:02:47 +0000 Subject: [PATCH] Time initialization fixes. 1) Offset types "system-offset", "gmt-offset", 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 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index ed50f01b7..49e1ced0d 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -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 );