Open 3D Engine AzCore API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::ITime Class Referenceabstract

This is an AZ::Interface<> for managing time related operations. AZ::ITime and associated types may not operate in realtime. These abstractions are to allow our application simulation to operate both slower and faster than realtime in a well defined and user controllable manner The rate at which time passes for AZ::ITime is controlled by the cvar t_simulationTickScale t_simulationTickScale == 0 means simulation time should halt 0 < t_simulationTickScale < 1 will cause time to pass slower than realtime, with t_simulationTickScale 0.1 being roughly 1/10th realtime t_simulationTickScale == 1 will cause time to pass at roughly realtime t_simulationTickScale > 1 will cause time to pass faster than normal, with t_simulationTickScale 10 being roughly 10x realtime. More...

#include <ITime.h>

Public Member Functions

 AZ_RTTI (ITime, "{89D22C98-1450-44F1-952F-41284CC355F9}")
 
virtual TimeMs GetElapsedTimeMs () const =0
 
virtual TimeUs GetElapsedTimeUs () const =0
 
virtual TimeMs GetRealElapsedTimeMs () const =0
 
virtual TimeUs GetRealElapsedTimeUs () const =0
 
virtual void SetElapsedTimeMsDebug (TimeMs time)=0
 
virtual void SetElapsedTimeUsDebug (TimeUs time)=0
 
virtual TimeUs GetSimulationTickDeltaTimeUs () const =0
 
virtual TimeUs GetRealTickDeltaTimeUs () const =0
 
virtual TimeUs GetLastSimulationTickTime () const =0
 Returns the time since application start of when the last simulation tick was updated.
 
virtual void SetSimulationTickDeltaOverride (TimeMs timeMs)=0
 
virtual void SetSimulationTickDeltaOverride (TimeUs timeUs)=0
 
virtual TimeUs GetSimulationTickDeltaOverride () const =0
 
virtual void SetSimulationTickScale (float scale)=0
 
virtual float GetSimulationTickScale () const =0
 
virtual void SetSimulationTickRate (int rate)=0
 
virtual int32_t GetSimulationTickRate () const =0
 
 AZ_DISABLE_COPY_MOVE (ITime)
 

Static Public Attributes

static const AZ::TimeMs ZeroTimeMs = AZ::TimeMs{ 0 }
 
static const AZ::TimeUs ZeroTimeUs = AZ::TimeUs{ 0 }
 

Detailed Description

This is an AZ::Interface<> for managing time related operations. AZ::ITime and associated types may not operate in realtime. These abstractions are to allow our application simulation to operate both slower and faster than realtime in a well defined and user controllable manner The rate at which time passes for AZ::ITime is controlled by the cvar t_simulationTickScale t_simulationTickScale == 0 means simulation time should halt 0 < t_simulationTickScale < 1 will cause time to pass slower than realtime, with t_simulationTickScale 0.1 being roughly 1/10th realtime t_simulationTickScale == 1 will cause time to pass at roughly realtime t_simulationTickScale > 1 will cause time to pass faster than normal, with t_simulationTickScale 10 being roughly 10x realtime.

Member Function Documentation

◆ GetElapsedTimeMs()

virtual TimeMs AZ::ITime::GetElapsedTimeMs ( ) const
pure virtual

Returns the number of milliseconds since application start scaled by t_simulationTickScale.

Returns
The number of milliseconds that have elapsed since application start.

◆ GetElapsedTimeUs()

virtual TimeUs AZ::ITime::GetElapsedTimeUs ( ) const
pure virtual

Returns the number of microseconds since application start scaled by t_simulationTickScale.

Returns
the number of microseconds that have elapsed since application start

◆ GetRealElapsedTimeMs()

virtual TimeMs AZ::ITime::GetRealElapsedTimeMs ( ) const
pure virtual

Returns the number of milliseconds since application start. This value is not affected by the t_simulationTickScale cvar.

Returns
The number of milliseconds that have elapsed since application start.

◆ GetRealElapsedTimeUs()

virtual TimeUs AZ::ITime::GetRealElapsedTimeUs ( ) const
pure virtual

Returns the number of microseconds since application start. This value is not affected by the t_simulationTickScale cvar.

Returns
The number of microseconds that have elapsed since application start.

◆ GetRealTickDeltaTimeUs()

virtual TimeUs AZ::ITime::GetRealTickDeltaTimeUs ( ) const
pure virtual

Returns the non-manipulated tick time.

Returns
The number of microseconds elapsed since the last game tick.

◆ GetSimulationTickDeltaOverride()

virtual TimeUs AZ::ITime::GetSimulationTickDeltaOverride ( ) const
pure virtual

Returns the current simulation tick override. 0 means disabled.

Returns
The current simulation tick override in milliseconds.

◆ GetSimulationTickDeltaTimeUs()

virtual TimeUs AZ::ITime::GetSimulationTickDeltaTimeUs ( ) const
pure virtual

Returns the current simulation tick delta time. This is affected by the cvars t_simulationTickScale, t_simulationTickDeltaOverride, and t_maxGameTickDelta.

Returns
The number of microseconds elapsed since the last game tick.

◆ GetSimulationTickRate()

virtual int32_t AZ::ITime::GetSimulationTickRate ( ) const
pure virtual

Return the current simulation tick rate. 0 means disabled.

Returns
The rate in frames per second.

◆ GetSimulationTickScale()

virtual float AZ::ITime::GetSimulationTickScale ( ) const
pure virtual

Returns the current simulation tick scale. 1.0 == realtime, 0.5 == half realtime, 2.0 == doubletime.

Returns
The simulation tick scale value.

◆ SetElapsedTimeMsDebug()

virtual void AZ::ITime::SetElapsedTimeMsDebug ( TimeMs  time)
pure virtual

Sets the number of milliseconds since application start. For debug purposes only.

Parameters
Thenumber of milliseconds that have elapsed since application start.

◆ SetElapsedTimeUsDebug()

virtual void AZ::ITime::SetElapsedTimeUsDebug ( TimeUs  time)
pure virtual

Sets the number of microseconds since application start. For debug purposes only.

Parameters
Thenumber of microseconds that have elapsed since application start.

◆ SetSimulationTickDeltaOverride()

virtual void AZ::ITime::SetSimulationTickDeltaOverride ( TimeMs  timeMs)
pure virtual

If > 0 this will override the simulation tick delta time with the provided value. When enabled this will ignore any set simulation tick scale. Setting to 0 disables the override.

Parameters
timeMsThe time in milliseconds to use for the tick delta.

◆ SetSimulationTickRate()

virtual void AZ::ITime::SetSimulationTickRate ( int  rate)
pure virtual

The minimum rate to force the simulation tick to run. 0 for as fast as possible. 30 = ~33ms, 60 = ~16ms. Setting to 0 will disable rate limiting.

Note
It is not guaranteed to hit the requested tick rate exactly.
Parameters
rateThe rate in frames per second.

◆ SetSimulationTickScale()

virtual void AZ::ITime::SetSimulationTickScale ( float  scale)
pure virtual

A scalar amount to adjust the passage of time by, 1.0 == realtime, 0.5 == half realtime, 2.0 == doubletime.

Parameters
scaleThe scalar value to apply to the simulation time.

The documentation for this class was generated from the following file: