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>
|
static const AZ::TimeMs | ZeroTimeMs = AZ::TimeMs{ 0 } |
|
static const AZ::TimeUs | ZeroTimeUs = AZ::TimeUs{ 0 } |
|
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.
◆ 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
-
The | number 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
-
The | number 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
-
timeMs | The 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
-
rate | The 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
-
scale | The scalar value to apply to the simulation time. |
The documentation for this class was generated from the following file:
- Code/Framework/AzCore/AzCore/Time/ITime.h