UGameplayStatics::GetAccurateRealTime
#include "Kismet/GameplayStatics.h"
Access: public
Specifiers: staticBlueprintPure
Description
Returns the time in seconds since the application was started, sampled at the exact moment this function is called rather than once per frame. Use when sub-frame timing accuracy is needed.
Caveats & Gotchas
- • Unlike GetTimeSeconds or GetRealTimeSeconds, this is sampled at call time — calling it multiple times in one frame returns different values, which can cause inconsistencies if you compare results across calls.
- • The result is split into whole seconds and a fractional part to avoid double precision loss at large values; always combine both outputs (Seconds + PartialSeconds) for the full value.
- • This is wall-clock time from application start, not affected by pause or time dilation — unsuitable as a gameplay timer.
Signature
static ENGINE_API void GetAccurateRealTime(int32& Seconds, double& PartialSeconds); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Seconds | int32& | Output: whole seconds since the application was started. | — |
| PartialSeconds | double& | Output: fractional seconds component of the current time. | — |
Return Type
void Example
High-precision timestamp C++
int32 Sec;
double PartSec;
UGameplayStatics::GetAccurateRealTime(Sec, PartSec);
double FullTime = static_cast<double>(Sec) + PartSec;
UE_LOG(LogTemp, Log, TEXT("Accurate time: %f"), FullTime); See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?