RealDocs

UKismetMathLibrary::MakeTimespan

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

Description

Constructs an FTimespan from individual time components. In Blueprint this is the standard 'Make Timespan' node. A second overload, MakeTimespan2, accepts nanosecond fractions instead of milliseconds.

Caveats & Gotchas

  • Component values are not clamped — passing Hours=25 does not produce an error but adds an extra 25 hours to the total, not 1 hour. Components accumulate additively, so validate inputs before calling if they come from user data.
  • Milliseconds is the finest resolution this overload provides. For sub-millisecond precision use MakeTimespan2, which accepts a fractional nanoseconds parameter.

Signature

static ENGINE_API FTimespan MakeTimespan(int32 Days, int32 Hours, int32 Minutes, int32 Seconds, int32 Milliseconds);

Parameters

Name Type Description Default
Days int32 Number of days (can be negative for negative durations).
Hours int32 Hours component (0–23 typical; values outside this range carry over).
Minutes int32 Minutes component.
Seconds int32 Seconds component.
Milliseconds int32 Milliseconds component.

Return Type

FTimespan

Example

Create a 1-hour 30-minute cooldown C++
FTimespan Cooldown = UKismetMathLibrary::MakeTimespan(0, 1, 30, 0, 0); // 1h 30m
FDateTime CooldownEnd = FDateTime::UtcNow() + Cooldown;

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.