Clock story in TimeManager: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(Created page with "{{stub}} ===Clock story, an exploration of timeManager.cxx=== We'll make a travel in the clock's country, to understand what's happening in [https://sourceforge.net/p/flight...")
 
(→‎Prior 2018: sim time)
Line 6: Line 6:


=Prior 2018=
=Prior 2018=
The simulation time: the simulated time clock was something basic, we started at 0, do some clamping on the delta, (sim/max-simtime-per-frame) then only allow dt to be multiple of 1/modelHz  (120 by default) this give a "dtRemainder" difference between the time we mesured, and the time we keep as timestamp;
Then is applied time acceleration, giving a sim time unrelated to real time flow, for time accel != 1
we have a clock :
having 1/modelHz as basic step (before time accel)
able to pause
suffering for acceleration if time accel is used
This simulation time was used for the flight simulation as intended, but was the timestamp reference for mp protocol.
That's what lead to the 2018 change, the need to a clock for the mp protocol, not based on simulated time, but a "real time" timestamp.


= before 2021=
= before 2021=

Revision as of 20:10, 15 January 2021

This article is a stub. You can help the wiki by expanding it.

Clock story, an exploration of timeManager.cxx

We'll make a travel in the clock's country, to understand what's happening in TimeManager.cxx. Initially only dedicated to calculate the frame time increment (dt) passed to lot's of subsystems in the update loops, but now having a responsibility in time synchronization between different FG session.

Prior 2018

The simulation time: the simulated time clock was something basic, we started at 0, do some clamping on the delta, (sim/max-simtime-per-frame) then only allow dt to be multiple of 1/modelHz (120 by default) this give a "dtRemainder" difference between the time we mesured, and the time we keep as timestamp; Then is applied time acceleration, giving a sim time unrelated to real time flow, for time accel != 1

we have a clock :

having 1/modelHz as basic step (before time accel)
able to pause
suffering for acceleration if time accel is used

This simulation time was used for the flight simulation as intended, but was the timestamp reference for mp protocol. That's what lead to the 2018 change, the need to a clock for the mp protocol, not based on simulated time, but a "real time" timestamp.

before 2021

2021 (hopefully)