= fgGetNode("/position/latitude-deg");
static const SGPropertyNode *altitude
= fgGetNode("/position/altitude-ft");
+ static const SGPropertyNode *clock_freeze
+ = fgGetNode("/sim/freeze/clock", true);
static const SGPropertyNode *cur_time_override
= fgGetNode("/sim/time/cur-time-override", true);
// cout << "Warp = " << globals->get_warp() << endl;
// update "time"
- if ( globals->get_warp_delta() != 0 ) {
- globals->inc_warp( globals->get_warp_delta() );
+ static bool last_clock_freeze = false;
+
+ if ( clock_freeze->getBoolValue() ) {
+ // clock freeze requested
+ if ( cur_time_override->getLongValue() == 0 ) {
+ fgSetLong( "/sim/time/cur-time-override",
+ t->get_cur_time() + globals->get_warp() );
+ globals->set_warp( 0 );
+ }
+ } else {
+ // no clock freeze requested
+ if ( last_clock_freeze == true ) {
+ // clock just unfroze, let's set warp as the difference
+ // between frozen time and current time so we don't get a
+ // time jump (and corresponding sky object and lighting
+ // jump.)
+ globals->set_warp( cur_time_override->getLongValue() - time(NULL) );
+ fgSetLong( "/sim/time/cur-time-override", 0 );
+ }
+ if ( globals->get_warp_delta() != 0 ) {
+ globals->inc_warp( globals->get_warp_delta() );
+ }
}
+ last_clock_freeze = clock_freeze->getBoolValue();
+
t->update( longitude->getDoubleValue() * SGD_DEGREES_TO_RADIANS,
latitude->getDoubleValue() * SGD_DEGREES_TO_RADIANS,
cur_time_override->getLongValue(),
// Freeze options
fgSetBool("/sim/freeze/master", false);
fgSetBool("/sim/freeze/position", false);
- fgSetBool("/sim/freeze/time-of-day", false);
+ fgSetBool("/sim/freeze/clock", false);
fgSetBool("/sim/freeze/fuel", false);
}
fgSetBool("/sim/freeze/fuel", false);
} else if ( arg == "--enable-fuel-freeze" ) {
fgSetBool("/sim/freeze/fuel", true);
- } else if ( arg == "--disable-tod-freeze" ) {
- fgSetBool("/sim/freeze/time-of-day", false);
- } else if ( arg == "--enable-tod-freeze" ) {
- fgSetBool("/sim/freeze/time-of-day", true);
+ } else if ( arg == "--disable-clock-freeze" ) {
+ fgSetBool("/sim/freeze/clock", false);
+ } else if ( arg == "--enable-clock-freeze" ) {
+ fgSetBool("/sim/freeze/clock", true);
} else if ( arg == "--disable-anti-alias-hud" ) {
fgSetBool("/sim/hud/antialiased", false);
} else if ( arg == "--enable-anti-alias-hud" ) {
<< " --enable-freeze Start in a frozen state" << endl
<< " --disable-fuel-freeze Fuel is consumed normally" << endl
<< " --enable-fuel-freeze Fuel tank quantity forced to remain constant" << endl
- << " --disable-tod-freeze Time of day advances normally" << endl
- << " --enable-tod-freeze Do not advance time of day" << endl
+ << " --disable-clock-freeze Clock advances normally" << endl
+ << " --enable-clock-freeze Do not advance clock" << endl
<< " --control=mode Primary control mode (joystick, keyboard," << endl
<< " mouse)" << endl
<< " --enable-auto-coordination Enable auto coordination" << endl