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 systemLocalTime = sgTimeGetGMT( localtime(&cur_time) );
|
||||||
time_t aircraftLocalTime =
|
time_t aircraftLocalTime =
|
||||||
sgTimeGetGMT( fgLocaltime(&cur_time, t->get_zonename() ) );
|
sgTimeGetGMT( fgLocaltime(&cur_time, t->get_zonename() ) );
|
||||||
|
|
||||||
// Okay, we now have several possible scenarios
|
// Okay, we now have several possible scenarios
|
||||||
int offset = fgGetInt("/sim/startup/time-offset");
|
int offset = fgGetInt("/sim/startup/time-offset");
|
||||||
string offset_type = fgGetString("/sim/startup/time-offset-type");
|
string offset_type = fgGetString("/sim/startup/time-offset-type");
|
||||||
|
@ -1476,16 +1476,19 @@ void fgInitTimeOffset() {
|
||||||
180.0, false );
|
180.0, false );
|
||||||
} else if ( offset_type == "system-offset" ) {
|
} else if ( offset_type == "system-offset" ) {
|
||||||
warp = offset;
|
warp = offset;
|
||||||
|
orig_warp = 0;
|
||||||
} else if ( offset_type == "gmt-offset" ) {
|
} else if ( offset_type == "gmt-offset" ) {
|
||||||
warp = offset - (currGMT - systemLocalTime);
|
warp = offset - (currGMT - systemLocalTime);
|
||||||
|
orig_warp = 0;
|
||||||
} else if ( offset_type == "latitude-offset" ) {
|
} else if ( offset_type == "latitude-offset" ) {
|
||||||
warp = offset - (aircraftLocalTime - systemLocalTime);
|
warp = offset - (aircraftLocalTime - systemLocalTime);
|
||||||
|
orig_warp = 0;
|
||||||
} else if ( offset_type == "system" ) {
|
} else if ( offset_type == "system" ) {
|
||||||
warp = offset - cur_time;
|
warp = offset - (systemLocalTime - currGMT) - cur_time;
|
||||||
} else if ( offset_type == "gmt" ) {
|
} else if ( offset_type == "gmt" ) {
|
||||||
warp = offset - currGMT;
|
warp = offset - cur_time;
|
||||||
} else if ( offset_type == "latitude" ) {
|
} else if ( offset_type == "latitude" ) {
|
||||||
warp = offset - (aircraftLocalTime - systemLocalTime) - cur_time;
|
warp = offset - (aircraftLocalTime - currGMT)- cur_time;
|
||||||
} else {
|
} else {
|
||||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||||
"FG_TIME::Unsupported offset type " << offset_type );
|
"FG_TIME::Unsupported offset type " << offset_type );
|
||||||
|
|
Loading…
Add table
Reference in a new issue