UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FGenericPlatformTime Struct Reference

#include <GenericPlatformTime.h>

+ Inheritance diagram for FGenericPlatformTime:

Static Public Member Functions

static CORE_API TCHARStrDate (TCHAR *Dest, SIZE_T DestSize)
 
static CORE_API TCHARStrTime (TCHAR *Dest, SIZE_T DestSize)
 
static CORE_API const TCHARStrTimestamp ()
 
static CORE_API FString PrettyTime (double Seconds)
 
static bool UpdateCPUTime (float DeltaTime)
 
static bool UpdateThreadCPUTime (float=0.0)
 
static void AutoUpdateGameThreadCPUTime (double UpdateInterval)
 
static FCPUTime GetCPUTime ()
 
static FCPUTime GetThreadCPUTime ()
 
static double GetLastIntervalCPUTimeInSeconds ()
 
static double GetLastIntervalThreadCPUTimeInSeconds ()
 
static double GetSecondsPerCycle ()
 
static float ToMilliseconds (const uint32 Cycles)
 
static float ToSeconds (const uint32 Cycles)
 
static double GetSecondsPerCycle64 ()
 
static double ToMilliseconds64 (const uint64 Cycles)
 
static double ToSeconds64 (const uint64 Cycles)
 
static uint64 SecondsToCycles64 (double Seconds)
 

Static Protected Attributes

static CORE_API double SecondsPerCycle = 0.0
 
static CORE_API double SecondsPerCycle64 = 0.0
 
static CORE_API double LastIntervalCPUTimeInSeconds = 0.0
 

Detailed Description

Generic implementation for most platforms

Member Function Documentation

◆ AutoUpdateGameThreadCPUTime()

static void FGenericPlatformTime::AutoUpdateGameThreadCPUTime ( double  UpdateInterval)
inlinestatic

Registers automatic updates of Game Thread CPU utilization

◆ GetCPUTime()

static FCPUTime FGenericPlatformTime::GetCPUTime ( )
inlinestatic
Returns
structure that contains CPU utilization data.

◆ GetLastIntervalCPUTimeInSeconds()

static double FGenericPlatformTime::GetLastIntervalCPUTimeInSeconds ( )
inlinestatic
Returns
the cpu processing time (kernel + user time of all threads) from the last update

◆ GetLastIntervalThreadCPUTimeInSeconds()

static double FGenericPlatformTime::GetLastIntervalThreadCPUTimeInSeconds ( )
inlinestatic

Gets the per-thread CPU processing time (kernel + user) from the last update

Returns
The per-thread CPU processing time from the last update

◆ GetSecondsPerCycle()

static double FGenericPlatformTime::GetSecondsPerCycle ( )
inlinestatic

Each platform implements these two functions, which return the current time in platform-specific cpu cycles. Cycles64 should be used for most purposes as it may be higher resolution and will not roll over during execution:

static uint32 Cycles(); static uint64 Cycles64(); Returns seconds per cycle, to pair with Cycles().

◆ GetSecondsPerCycle64()

static double FGenericPlatformTime::GetSecondsPerCycle64 ( )
inlinestatic

Returns seconds per cycle, to pair with Cycles64().

◆ GetThreadCPUTime()

static FCPUTime FGenericPlatformTime::GetThreadCPUTime ( )
inlinestatic

Gets current threads CPU Utilization

Returns
Current threads CPU Utilization

◆ PrettyTime()

FString FGenericPlatformTime::PrettyTime ( double  Seconds)
static

Returns a pretty-string for a time given in seconds. (I.e. "4:31 min", "2:16:30 hours", etc)

Parameters
SecondsTime in seconds
Returns
Time in a pretty formatted string

◆ SecondsToCycles64()

static uint64 FGenericPlatformTime::SecondsToCycles64 ( double  Seconds)
inlinestatic

Convert seconds to cycles, can be added to Cycles64 to set a high resolution timeout

◆ StrDate()

TCHAR * FGenericPlatformTime::StrDate ( TCHAR Dest,
SIZE_T  DestSize 
)
static

Get the system date

Parameters
DestDestination buffer to copy to
DestSizeSize of destination buffer in characters
Returns
Date string in the format "MM/DD/YY"

◆ StrTime()

TCHAR * FGenericPlatformTime::StrTime ( TCHAR Dest,
SIZE_T  DestSize 
)
static

Get the system time

Parameters
DestDestination buffer to copy to
DestSizeSize of destination buffer in characters
Returns
Time string in the format "HH::mm::ss"

◆ StrTimestamp()

const TCHAR * FGenericPlatformTime::StrTimestamp ( )
static

Returns a timestamp string built from the current date and time. NOTE: Only one return value is valid at a time!

Returns
timestamp string in the format "MM/DD/YY HH::mm::ss"

◆ ToMilliseconds()

static float FGenericPlatformTime::ToMilliseconds ( const uint32  Cycles)
inlinestatic

Converts cycles to milliseconds.

◆ ToMilliseconds64()

static double FGenericPlatformTime::ToMilliseconds64 ( const uint64  Cycles)
inlinestatic

Converts 64 bit cycles to milliseconds.

◆ ToSeconds()

static float FGenericPlatformTime::ToSeconds ( const uint32  Cycles)
inlinestatic

Converts cycles to seconds.

◆ ToSeconds64()

static double FGenericPlatformTime::ToSeconds64 ( const uint64  Cycles)
inlinestatic

Converts 64 bit cycles to seconds.

◆ UpdateCPUTime()

static bool FGenericPlatformTime::UpdateCPUTime ( float  DeltaTime)
inlinestatic

Updates CPU utilization, called through a delegate from the Core ticker.

◆ UpdateThreadCPUTime()

static bool FGenericPlatformTime::UpdateThreadCPUTime ( float  = 0.0)
inlinestatic

Updates current thread CPU utilization, calling is user defined per-thread (unused float parameter, is for FTicker compatibility).

Member Data Documentation

◆ LastIntervalCPUTimeInSeconds

double FGenericPlatformTime::LastIntervalCPUTimeInSeconds = 0.0
staticprotected

◆ SecondsPerCycle

double FGenericPlatformTime::SecondsPerCycle = 0.0
staticprotected

◆ SecondsPerCycle64

double FGenericPlatformTime::SecondsPerCycle64 = 0.0
staticprotected

The documentation for this struct was generated from the following files: