RealDocs

UKismetMathLibrary::MakeTimespan2

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

Description

Constructs an FTimespan from days, hours, minutes, seconds, and a nanosecond fraction. Use this variant when you need sub-millisecond precision; prefer MakeTimespan when millisecond resolution is sufficient.

Caveats & Gotchas

  • FractionNano is the sub-second nanosecond component, not total nanoseconds — valid range is 0 to 999,999,999. Passing values outside this range will produce an incorrect timespan without error.
  • FTimespan stores time internally as int64 ticks (100-nanosecond intervals), so FractionNano is rounded to the nearest 100 ns before storage.

Signature

static ENGINE_API FTimespan MakeTimespan2(int32 Days, int32 Hours, int32 Minutes, int32 Seconds, int32 FractionNano);

Parameters

Name Type Description Default
Days int32 Number of days.
Hours int32 Number of hours (0–23).
Minutes int32 Number of minutes (0–59).
Seconds int32 Number of seconds (0–59).
FractionNano int32 Sub-second component in nanoseconds (0–999,999,999).

Return Type

FTimespan

Example

Create a high-precision timespan C++
// 1 day, 2 hours, 30 minutes, 15 seconds, 500,000,000 ns (0.5 s fraction)
FTimespan Span = UKismetMathLibrary::MakeTimespan2(1, 2, 30, 15, 500000000);
UE_LOG(LogTemp, Log, TEXT("Ticks: %lld"), Span.GetTicks());

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.