RealDocs

UGameplayStatics::GetTimeSeconds

function Engine Blueprint Since 4.0
#include "Kismet/GameplayStatics.h"
Access: public Specifiers: staticUFUNCTIONBlueprintPure

Description

Returns elapsed time in seconds since the world started, adjusted by time dilation. This clock stops when the game is paused, making it suitable for gameplay timers that should pause with the game.

Caveats & Gotchas

  • Time dilation (slow-motion, bullet time) affects this value — a 0.5x dilation will cause this to advance at half the wall-clock rate, which is usually what gameplay logic wants.
  • Pausing stops this timer; use GetUnpausedTimeSeconds or GetRealTimeSeconds for UI, cinematics, or anything that must keep running while paused.

Signature

static ENGINE_API double GetTimeSeconds(const UObject* WorldContextObject);

Parameters

Name Type Description Default
WorldContextObject const UObject* Object used to resolve the current world.

Return Type

double

Example

Measure time since an event C++
// Record when the player picks up a power-up.
double PickupTime = UGameplayStatics::GetTimeSeconds(this);

// Later, check how long ago it happened.
double Elapsed = UGameplayStatics::GetTimeSeconds(this) - PickupTime;
if (Elapsed > PowerUpDuration)
{
    ExpirePowerUp();
}

Tags

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.