RealDocs

UKismetMathLibrary::BreakTimespan2

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

Description

Decomposes an FTimespan into days, hours, minutes, seconds, and a nanosecond fraction. Use instead of BreakTimespan when sub-millisecond precision matters.

Caveats & Gotchas

  • FractionNano is a multiple of 100 because FTimespan uses 100-nanosecond tick resolution internally — you will never receive an odd value like 1 ns.
  • For negative timespans, FractionNano will be negative (or zero); account for this when formatting or comparing.

Signature

static ENGINE_API void BreakTimespan2(FTimespan InTimespan, int32& Days, int32& Hours, int32& Minutes, int32& Seconds, int32& FractionNano);

Parameters

Name Type Description Default
InTimespan FTimespan The timespan to decompose.
Days int32& Receives the days component.
Hours int32& Receives the hours component (0–23).
Minutes int32& Receives the minutes component (0–59).
Seconds int32& Receives the seconds component (0–59).
FractionNano int32& Receives the sub-second component in nanoseconds (0–999,999,999).

Return Type

void

Example

Log full precision timespan components C++
int32 Days, Hours, Minutes, Seconds, FractionNano;
UKismetMathLibrary::BreakTimespan2(Elapsed, Days, Hours, Minutes, Seconds, FractionNano);
UE_LOG(LogTemp, Log, TEXT("%d:%02d:%02d.%09d"), Hours + Days*24, Minutes, Seconds, FractionNano);

Version History

Introduced in: 4.17

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.