Add some missing bits from Mathias' carrier code.
This commit is contained in:
parent
161fb0c770
commit
337d0d1be6
2 changed files with 15 additions and 1 deletions
|
@ -79,7 +79,9 @@ FGInterface::_calc_multiloop (double dt)
|
|||
dt += remainder;
|
||||
remainder = 0;
|
||||
double ml = dt * hz;
|
||||
int multiloop = int(floor(ml));
|
||||
// Avoid roundoff problems by adding the roundoff itself.
|
||||
// ... ok, two times the roundoff to have enough room.
|
||||
int multiloop = int(floor(ml * (1.0 + 2.0*DBL_EPSILON)));
|
||||
remainder = (ml - multiloop) / hz;
|
||||
return (multiloop * speedup);
|
||||
}
|
||||
|
|
|
@ -240,6 +240,18 @@ static void fgMainLoop( void ) {
|
|||
|
||||
real_delta_time_sec
|
||||
= double(current_time_stamp - last_time_stamp) / 1000000.0;
|
||||
// round the real time down to a multiple of 1/model-hz.
|
||||
// this way all systems are updated the _same_ amount of dt.
|
||||
{
|
||||
static double rem = 0.0;
|
||||
real_delta_time_sec += rem;
|
||||
double hz = model_hz;
|
||||
double nit = floor(real_delta_time_sec*hz);
|
||||
rem = real_delta_time_sec - nit/hz;
|
||||
real_delta_time_sec = nit/hz;
|
||||
}
|
||||
|
||||
|
||||
if ( clock_freeze->getBoolValue() ) {
|
||||
delta_time_sec = 0;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue