1
0
Fork 0

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.
This commit is contained in:
durk 2006-07-09 08:02:47 +00:00
parent f339304c33
commit d68723f3da

View 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 );