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:
parent
f339304c33
commit
d68723f3da
1 changed files with 7 additions and 4 deletions
|
@ -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 );
|
||||
|
|
Loading…
Add table
Reference in a new issue