UKismetMathLibrary::Subtract_TimespanTimespan
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns A - B as a new FTimespan. The result can be negative if B is larger than A, which is a valid FTimespan state.
Caveats & Gotchas
- • A negative result is perfectly valid and represents a timespan going backwards — check the sign with GetTotalSeconds() < 0.0 before displaying it.
- • In C++ prefer the FTimespan - operator for clarity; this wrapper exists to expose subtraction to Blueprint.
Signature
static UE_INL_API FTimespan Subtract_TimespanTimespan( FTimespan A, FTimespan B ); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FTimespan | Left-hand timespan. | — |
| B | FTimespan | Timespan to subtract from A. | — |
Return Type
FTimespan Example
Compute remaining time C++
FTimespan Deadline = FTimespan::FromMinutes(10.0);
FTimespan Elapsed = FTimespan::FromMinutes(3.5);
FTimespan Remaining = UKismetMathLibrary::Subtract_TimespanTimespan(Deadline, Elapsed);
// Remaining == 6.5 minutes Tags
Version History
Introduced in: 4.7
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?