1
0
Fork 0

Fix some more uses of libC time()

This commit is contained in:
James Turner 2016-01-05 23:16:34 -06:00
parent 52f39abc6b
commit ed8970a29d

View file

@ -27,10 +27,6 @@
# include <config.h> # include <config.h>
#endif #endif
#ifdef HAVE_WINDOWS_H
#include <time.h>
#endif
#include <cstdio> #include <cstdio>
#include <simgear/compiler.h> #include <simgear/compiler.h>
@ -45,6 +41,7 @@
#include <simgear/structure/exception.hxx> #include <simgear/structure/exception.hxx>
#include <simgear/structure/commands.hxx> #include <simgear/structure/commands.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/timing/sg_time.hxx>
#include <simgear/sg_inlines.h> #include <simgear/sg_inlines.h>
#include "Main/fg_props.hxx" #include "Main/fg_props.hxx"
@ -454,12 +451,12 @@ void FGRouteMgr::update( double dt )
double gs = groundSpeed->getDoubleValue(); double gs = groundSpeed->getDoubleValue();
if (airborne->getBoolValue()) { if (airborne->getBoolValue()) {
time_t now = time(NULL); time_t now = globals->get_time_params()->get_cur_time();
elapsedFlightTime->setDoubleValue(difftime(now, _takeoffTime)); elapsedFlightTime->setDoubleValue(difftime(now, _takeoffTime));
if (weightOnWheels->getBoolValue()) { if (weightOnWheels->getBoolValue()) {
// touch down // touch down
destination->setIntValue("touchdown-time", time(NULL)); destination->setIntValue("touchdown-time", now);
airborne->setBoolValue(false); airborne->setBoolValue(false);
} }
} else { // not airborne } else { // not airborne
@ -467,7 +464,7 @@ void FGRouteMgr::update( double dt )
// either taking-off or rolling-out after touchdown // either taking-off or rolling-out after touchdown
} else { } else {
airborne->setBoolValue(true); airborne->setBoolValue(true);
_takeoffTime = time(NULL); // start the clock _takeoffTime = globals->get_time_params()->get_cur_time(); // start the clock
departure->setIntValue("takeoff-time", _takeoffTime); departure->setIntValue("takeoff-time", _takeoffTime);
} }
} }