UKismetMathLibrary::Divide_TimespanFloat
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Divides a timespan by a float scalar, returning a new FTimespan. Equivalent to multiplying by 1/Scalar.
Caveats & Gotchas
- • Division by zero produces an undefined result (internally a divide-by-zero on float) — always guard the Scalar before calling.
- • float precision limits apply for large timespans; consider computing (double)A.GetTotalSeconds() / divisor and reconstructing via FTimespan::FromSeconds() for critical accuracy.
Signature
static UE_INL_API FTimespan Divide_TimespanFloat( FTimespan A, float Scalar ); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FTimespan | The timespan to divide. | — |
| Scalar | float | Divisor. Must not be zero. | — |
Return Type
FTimespan Example
Split a total duration into equal segments C++
FTimespan TotalRace = FTimespan::FromMinutes(60.0);
float Laps = 4.0f;
FTimespan LapTime = UKismetMathLibrary::Divide_TimespanFloat(TotalRace, Laps);
// LapTime == 15 minutes Tags
Version History
Introduced in: 4.7
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?