Views
Personal tools

Simulated Time

From X-Plane SDK

Jump to: navigation, search

X-Plane tracks two forms of time: simulated time and real time.

  • Simulated time tracks the simulation of an airplane flight. It is affected by pausing the sim, doubling X-Plane's simulation rate, etc.
  • Real time tracks the actual real world time of the computer X-Plane is running on, and never stops or changes speed.

Simulated time can be tracked via the following datarefs:

  • sim/time/total_running_time_sec - simulated time in seconds since X-Plane started.
  • sim/time/total_flight_time_sec - simulated time in seconds since the las time the flight model was reset (E.g. an airplane load, etc).
  • sim/time/sim_speed - the multiplier between real time and sim time, e.g. 0 for paused, 1 for normal operation, 4 for 4x simulation.
  • sim/operation/misc/frame_rate_period - the length of a simulated graphics frame in simulation time.

The frame rate period has a few surprising effects:

  1. If the sim is paused, the frame rate period is zero, because no simulated time has elapsed from draw to draw.
  2. If the sim is in 2x simulation, the frame rate period doubles, because twice as much sim time goes by each time we draw.

Real time can be tracked using XPLMGetElaspedTime. Real time is also the time passed to the XPLMProcessing callback functions, and is the time used to schedule periodic flight loop callbacks.

Navigation
TOOLBOX
LANGUAGES
Toolbox