Navigation
API > API/Runtime > API/Runtime/Core
Utility class to create a timeout that will expire at a point in the future. Example usage:
FTimeout TimeoutFromTimespan(FTimespan::FromMilliseconds(2)); FTimeout TimeoutFromSeconds(0.002); while (!TimeoutFromSeconds.IsExpired()) { ... }
| Name | FTimeout |
| Type | class |
| Header File | /Engine/Source/Runtime/Core/Public/Misc/Timeout.h |
| Include Path | #include "Misc/Timeout.h" |
Syntax
class FTimeout
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| Construct a timeout that starts right now and will end after the passed in timespan | Misc/Timeout.h | ||
FTimeout
(
double TimeoutSeconds |
Construct a timeout that starts right now and will end after the passed in time in seconds | Misc/Timeout.h | |
| Construct a timeout that started at the same time as BaseTimeout, but with a new duration | Misc/Timeout.h | ||
FTimeout
(
uint64 StartValue, |
Misc/Timeout.h |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| NeverExpireCycles | uint64 | Misc/Timeout.h | |
| NeverExpireSeconds | double | Misc/Timeout.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| StartCycles | uint64 | Value of FPlatformTime::Cycles64 at timeout creation, cannot be directly converted to seconds. | Misc/Timeout.h | |
| TimeoutCycles | uint64 | Length of timeout, can be converted to seconds as it is relative to StartCycles. | Misc/Timeout.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
double GetElapsedSeconds() |
Returns time since the timeout was created, in seconds | Misc/Timeout.h | |
FTimespan GetElapsedTime() |
Returns time since the timeout was created, as a timespan | Misc/Timeout.h | |
uint32 GetRemainingRoundedUpMilliseconds() |
Intended for use in waiting functions, e.g. `FEvent::Wait()_ returns the whole number (rounded up) of remaining milliseconds, clamped into [0, MAX_uint32] range | Misc/Timeout.h | |
double GetRemainingSeconds() |
Returns time left until the timeout expires (which can be negative) in seconds | Misc/Timeout.h | |
FTimespan GetRemainingTime() |
Returns time left until the timeout expires (which can be negative) as a timespan | Misc/Timeout.h | |
double GetTimeoutSeconds() |
Returns duration of timeout in seconds | Misc/Timeout.h | |
FTimespan GetTimeoutValue() |
Returns duration of timeout as a timespan | Misc/Timeout.h | |
bool IsAlwaysExpired() |
Returns true if this was created from AlwaysExpired and does not need to be repeatedly checked | Misc/Timeout.h | |
bool IsExpired() |
Return true if elapsed time is greater than the initially requested timeout | Misc/Timeout.h | |
void ModifyTimeoutSeconds
(
double DeltaTimeoutSeconds |
Safely modify the remaining time by adding the delta time in seconds to the timeout | Misc/Timeout.h | |
void SetTimeoutSeconds
(
double TimeoutSeconds |
Sets the timeout to new value in seconds | Misc/Timeout.h | |
void SetToExpired() |
Set this timeout to explicitly expired without recalculating start time | Misc/Timeout.h | |
bool WillNeverExpire() |
Returns true if this was created from Never and does not need to be repeatedly checked | Misc/Timeout.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static FTimeout AlwaysExpired() |
Create a timeout that will always return true for IsExpired | Misc/Timeout.h | |
static FTimeout Never() |
Create a timeout that will never return true for IsExpired | Misc/Timeout.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
operator bool() |
Misc/Timeout.h |