1
0
Fork 0

Move view moving to end of loop

This commit is contained in:
portree_kid 2021-04-24 22:39:14 +02:00 committed by James Turner
parent 8fdc03981c
commit 986d061004
2 changed files with 16 additions and 2 deletions

View file

@ -1,6 +1,7 @@
#include "config.h" #include "config.h"
#include "test_suite/dataStore.hxx" #include "test_suite/dataStore.hxx"
#include <ctime>
#include "TestDataLogger.hxx" #include "TestDataLogger.hxx"
#include "testGlobals.hxx" #include "testGlobals.hxx"
@ -67,8 +68,7 @@ void initTestGlobals(const std::string& testName)
fgSetDefaults(); fgSetDefaults();
std::unique_ptr<TimeManager> t; auto t = globals->add_new_subsystem<TimeManager>(SGSubsystemMgr::INIT);
t.reset(new TimeManager);
t->init(); // establish mag-var data t->init(); // establish mag-var data
/** /**
@ -369,6 +369,15 @@ bool runForTimeWithCheck(double t, RunCheck check)
return false; return false;
} }
void adjustSimulationWorldTime(time_t desiredUnixTime)
{
int timeOffset = desiredUnixTime - time(nullptr);
globals->get_props()->setIntValue("/sim/time/cur-time-override", 0);
globals->get_props()->setIntValue("/sim/time/warp", timeOffset);
globals->get_subsystem<TimeManager>()->update(0.0);
}
void writeFlightPlanToKML(flightgear::FlightPlanRef fp) void writeFlightPlanToKML(flightgear::FlightPlanRef fp)
{ {
if (!global_loggingToKML) if (!global_loggingToKML)

View file

@ -48,6 +48,11 @@ void setPositionAndStabilise(const SGGeod& g);
void runForTime(double t); void runForTime(double t);
/**
@brief set the simulation date/time clock to 'time'
*/
void adjustSimulationWorldTime(time_t time);
using RunCheck = std::function<bool(void)>; using RunCheck = std::function<bool(void)>;
bool runForTimeWithCheck(double t, RunCheck check); bool runForTimeWithCheck(double t, RunCheck check);