RealDocs

UKismetMathLibrary::GetMilliseconds

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

Description

Returns the milliseconds component of the timespan (0–999 for positive spans). This is the sub-second millisecond remainder, not total milliseconds.

Caveats & Gotchas

  • Sub-millisecond data (microseconds/nanoseconds) stored in the timespan is silently dropped — use BreakTimespan2 if you need the full nanosecond fraction.
  • Returns a value in the range -999 to +999 for negative timespans; check the sign when building display strings.

Signature

static UE_INL_API int32 GetMilliseconds( FTimespan A );

Parameters

Name Type Description Default
A FTimespan The timespan to query.

Return Type

int32

Example

Show milliseconds in a stopwatch display C++
FTimespan Elapsed = FDateTime::Now() - StartTime;
int32 S  = UKismetMathLibrary::GetSeconds(Elapsed);
int32 Ms = UKismetMathLibrary::GetMilliseconds(Elapsed);
FString Display = FString::Printf(TEXT("%02d.%03d"), S, Ms);

Version History

Introduced in: 4.7

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.