Navigation
API > API/Runtime > API/Runtime/Core
Provides global game timing information (delta time, current time etc). The current time is set each frame by the game thread. It may then be retrieved by the game thread and other task threads via FAppTime::Get(). The value from the game thread is pipelined through the TaskGraph such that child tasks receive the correct value for the frame the tasks were spawned in.
| Name | FAppTime |
| Type | class |
| Header File | /Engine/Source/Runtime/Core/Public/Misc/AppTime.h |
| Include Path | #include "Misc/AppTime.h" |
Syntax
class FAppTime
Structs
| Name | Remarks |
|---|---|
| TRelaxedAtomic | Helper type to perform automatic relaxed-order loads/stores of a std::atomic. |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| bUseFixedTimeStep | bool | Misc/AppTime.h | |
| GameThreadInstance | FAppTime | Misc/AppTime.h | |
| TLSInstance | thread_local TSharedPtr< const FAppTime > | Misc/AppTime.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| CurrentFrameTime | TOptional< FQualifiedFrameTime > | Holds the current frame time and framerate. | Misc/AppTime.h | |
| CurrentTime | TRelaxedAtomic< double > | Holds current time. | Misc/AppTime.h | |
| DeltaTime | double | Holds current delta time in seconds. | Misc/AppTime.h | |
| FixedDeltaTime | double | Holds time step if a fixed delta time is wanted. | Misc/AppTime.h | |
| GameTime | double | Holds overall game time. | Misc/AppTime.h | |
| IdleTime | double | Holds time we spent sleeping in UpdateTimeAndHandleMaxTickRate() if our frame time was smaller than one allowed by target FPS. | Misc/AppTime.h | |
| IdleTimeOvershoot | double | Holds the amount of IdleTime that was LONGER than we tried to sleep. The OS can't sleep the exact amount of time, so this measures that overshoot. | Misc/AppTime.h | |
| LastTime | double | Holds previous value of CurrentTime. | Misc/AppTime.h |
Functions
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static TSharedPtr< const FAppTime > Fork() |
Misc/AppTime.h | ||
| Returns the FAppTime value for the current thread's time context. | Misc/AppTime.h | ||
static const FAppTime & Get_UnsafeNoCheck() |
Misc/AppTime.h | ||
static double GetApproximateCurrentTime () |
Equivalent to GetCurrentTime(), but can be called from any thread, rather than only from threads with valid time contexts. | Misc/AppTime.h | |
static TOptional< FQualifiedFrameTime > GetCurrentFrameTime () |
Gets a frame number generated by the engine's timecode provider. | Misc/AppTime.h | |
static double GetCurrentTime() |
Gets current frame's time in seconds. | Misc/AppTime.h | |
static double GetDeltaTime() |
Gets the current frame's time delta in seconds. | Misc/AppTime.h | |
static double GetFixedDeltaTime () |
Gets time step in seconds if a fixed delta time is wanted. | Misc/AppTime.h | |
static double GetGameTime() |
Gets overall game time in seconds. | Misc/AppTime.h | |
static double GetIdleTime() |
Gets idle time in seconds. | Misc/AppTime.h | |
static double GetIdleTimeOvershoot() |
Gets idle time overshoot in seconds (the time beyond the wait time we requested for the frame). Only valid when IdleTime is > 0. | Misc/AppTime.h | |
static double GetLastTime() |
Gets the previous frame's value of CurrentTime. | Misc/AppTime.h | |
static FTimecode GetTimecode () |
Convert the current frame time into a readable timecode. | Misc/AppTime.h | |
static FFrameRate GetTimecodeFrameRate() |
Get the frame rate of the current frame time. If the current frame time is not set, the frame rate value will be defaulted. | Misc/AppTime.h | |
static void InvalidateCurrentFrameTime() |
Misc/AppTime.h | ||
static void Restore
(
TSharedPtr< const FAppTime >&& Ptr |
Misc/AppTime.h | ||
static void Set
(
const FAppTime& NewValue |
Sets the new FAppTime value. May only be called from the game thread. | Misc/AppTime.h | |
static void SetCurrentFrameTime
(
FQualifiedFrameTime InFrameTime |
Misc/AppTime.h | ||
static void SetCurrentTime
(
double Seconds |
Misc/AppTime.h | ||
static void SetDeltaTime
(
double Seconds |
Misc/AppTime.h | ||
static void SetFixedDeltaTime
(
double Seconds |
Setter functions matching those from FApp | Misc/AppTime.h | |
static void SetGameTime
(
double Seconds |
Misc/AppTime.h | ||
static void SetIdleTime
(
double Seconds |
Misc/AppTime.h | ||
static void SetIdleTimeOvershoot
(
double Seconds |
Misc/AppTime.h | ||
static void SetUseFixedTimeStep
(
bool bVal |
Misc/AppTime.h | ||
static void UpdateLastTime() |
Misc/AppTime.h | ||
static bool UseFixedTimeStep() |
Gets whether we want to use a fixed time step or not. | Misc/AppTime.h |