UKismetMathLibrary::ToUnixTimestampDouble
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Returns seconds since the Unix Epoch as a double, preserving sub-second precision lost by the int64 variant. Useful when millisecond or finer resolution is needed.
Caveats & Gotchas
- • Double-precision floats have 53 bits of mantissa. For dates in 2024 the Unix timestamp is ~1.7 × 10⁹, which is representable exactly; however, the fractional seconds component may lose precision for timestamps far in the future (year 2262+).
- • The same time-zone caveat applies as ToUnixTimestamp — pass a UTC FDateTime for a correct Unix timestamp.
Signature
static UE_INL_API double ToUnixTimestampDouble(const FDateTime& Time); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Time | const FDateTime& | The FDateTime to convert. | — |
Return Type
double Example
Measure sub-second event latency C++
double T0 = UKismetMathLibrary::ToUnixTimestampDouble(UKismetMathLibrary::UtcNow());
DoSomething();
double T1 = UKismetMathLibrary::ToUnixTimestampDouble(UKismetMathLibrary::UtcNow());
UE_LOG(LogTemp, Log, TEXT("Elapsed: %.4f seconds"), T1 - T0); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?