UKismetMathLibrary::Multiply_TimespanFloat
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Scales a timespan by a float multiplier, returning a new FTimespan. Useful for time-scaling effects such as slow-motion or speed multipliers.
Caveats & Gotchas
- • Scalar is a float, not double — for very large timespans (days or weeks) the float precision may introduce tick-level rounding errors. Cast to double and use FTimespan directly if precision matters.
- • Multiplying by a negative scalar produces a valid negative timespan; multiplying by zero yields FTimespan::Zero().
Signature
static UE_INL_API FTimespan Multiply_TimespanFloat( FTimespan A, float Scalar ); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FTimespan | The timespan to scale. | — |
| Scalar | float | Multiplier applied to the timespan's tick count. | — |
Return Type
FTimespan Example
Apply a slow-motion factor to a cooldown duration C++
FTimespan BaseCooldown = FTimespan::FromSeconds(5.0);
float SlowMotionFactor = 2.0f;
FTimespan ScaledCooldown = UKismetMathLibrary::Multiply_TimespanFloat(BaseCooldown, SlowMotionFactor);
// ScaledCooldown == 10 seconds Tags
Version History
Introduced in: 4.7
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?