UKismetMathLibrary::GetTotalMilliseconds
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns the total elapsed time of the timespan expressed as a fractional number of milliseconds. Useful for performance timing and latency measurements where you want a single numeric value.
Caveats & Gotchas
- • FTimespan internally stores ticks at 100-nanosecond resolution. GetTotalMilliseconds loses sub-millisecond precision that the underlying data contains — if you need sub-ms resolution, work with FTimespan::GetTicks() directly.
- • For very large timespans (days to weeks), the double result may not have enough mantissa bits to represent individual milliseconds exactly. This is rarely a practical concern but worth knowing for high-precision instrumentation.
Signature
static UE_INL_API double GetTotalMilliseconds( FTimespan A ); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FTimespan | The timespan to query. | — |
Return Type
double Example
Measure elapsed time in milliseconds C++
FDateTime Start = FDateTime::UtcNow();
// ... some work ...
FTimespan Elapsed = FDateTime::UtcNow() - Start;
double Ms = UKismetMathLibrary::GetTotalMilliseconds(Elapsed);
UE_LOG(LogTemp, Log, TEXT("Elapsed: %.2f ms"), Ms); See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?