Navigation
Unreal Engine C++ API Reference > Runtime > Core > Misc
References
Module | Core |
Header | /Engine/Source/Runtime/Core/Public/Misc/Timespan.h |
Include | #include "Misc/Timespan.h" |
Syntax
struct FTimespan
Remarks
Implements a time span.
A time span is the difference between two dates and times. For example, the time span between 12:00:00 January 1, 2000 and 18:00:00 January 2, 2000 is 30.0 hours. Time spans are measured in positive or negative ticks depending on whether the difference is measured forward or backward. Each tick has a resolution of 0.1 microseconds (= 100 nanoseconds).
In conjunction with the companion class FDateTime, time spans can be used to perform date and time based arithmetic, such as calculating the difference between two dates or adding a certain amount of time to a given date.
When initializing time span values from single components, consider using the FromHours, FromMinutes, FromSeconds, Zero, MinValue and related methods instead of calling the overloaded constructors as they will make your code easier to read and understand.
Constructors
Type | Name | Description | |
---|---|---|---|
![]() |
FTimespan () |
Default constructor (zero initialization). | |
![]() |
FTimespan
(
int64 InTicks |
Create and initialize a new time interval with the specified number of ticks. | |
![]() |
FTimespan
(
int32 Hours, |
Create and initialize a new time interval with the specified number of hours, minutes and seconds. | |
![]() |
FTimespan
(
int32 Days, |
Create and initialize a new time interval with the specified number of days, hours, minutes and seconds. | |
![]() |
FTimespan
(
int32 Days, |
Create and initialize a new time interval with the specified number of days, hours, minutes and seconds. |
Functions
Type | Name | Description | |
---|---|---|---|
![]() |
void | Assign
(
int32 Days, |
Assign the specified components to this time span. |
![]() ![]() |
bool | ExportTextItem
(
FString& ValueStr, |
Export this time span value to a string. |
![]() ![]() |
FTimespan | FromDays
(
double Days |
Create a time span that represents the specified number of days. |
![]() ![]() |
FTimespan | FromHours
(
double Hours |
Create a time span that represents the specified number of hours. |
![]() ![]() |
FTimespan | FromMicroseconds
(
double Microseconds |
Create a time span that represents the specified number of microseconds. |
![]() ![]() |
FTimespan | FromMilliseconds
(
double Milliseconds |
Create a time span that represents the specified number of milliseconds. |
![]() ![]() |
FTimespan | FromMinutes
(
double Minutes |
Create a time span that represents the specified number of minutes. |
![]() ![]() |
FTimespan | FromSeconds
(
double Seconds |
Create a time span that represents the specified number of seconds. |
![]() ![]() |
int32 | GetDays () |
Get the days component of this time span. |
![]() |
FTimespan | GetDuration () |
Get a time span with the absolute value of this time span. |
![]() ![]() |
int32 | Gets the fractional seconds (in microsecond resolution). | |
![]() ![]() |
int32 | Gets the fractional seconds (in millisecond resolution). | |
![]() ![]() |
int32 | Gets the fractional seconds (in nanosecond resolution). | |
![]() ![]() |
int32 | Gets the fractional ticks (in 100 nanosecond resolution). | |
![]() ![]() |
int32 | GetHours () |
Gets the hours component of this time span. |
![]() ![]() |
int32 | GetMinutes () |
Get the minutes component of this time span. |
![]() ![]() |
int32 | GetSeconds () |
Get the seconds component of this time span. |
![]() ![]() |
int64 | GetTicks () |
Get the number of ticks represented by this time span. |
![]() ![]() |
double | GetTotalDays () |
Get the total number of days represented by this time span. |
![]() ![]() |
double | Get the total number of hours represented by this time span. | |
![]() ![]() |
double | Get the total number of microseconds represented by this time span. | |
![]() ![]() |
double | Get the total number of milliseconds represented by this time span. | |
![]() ![]() |
double | Get the total number of minutes represented by this time span. | |
![]() ![]() |
double | Get the total number of seconds represented by this time span. | |
![]() |
bool | ImportTextItem
(
const TCHAR*& Buffer, |
Import a time span value from a text buffer. |
![]() ![]() |
bool | IsZero () |
Check whether this time span is zero. |
![]() ![]() |
FTimespan | MaxValue () |
Return the maximum time span value. |
![]() ![]() |
FTimespan | MinValue () |
Return the minimum time span value. |
![]() |
bool | NetSerialize
(
FArchive& Ar, |
Serializes this date and time for network transmission |
![]() ![]() |
bool | Convert a string to a time span. | |
![]() ![]() |
double | Ratio between two time spans (handles zero values). | |
![]() |
bool | Serialize this time span from or into the specified archive. | |
![]() ![]() |
FString | ToString () |
Return the string representation of this time span using a default format. |
![]() ![]() |
FString | ToString
(
const TCHAR* Format |
Convert this time span to its string representation. |
![]() ![]() |
FTimespan | Zero () |
Return the zero time span value. |
Operators
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
FTimespan | Return the result of subtracting the given time span from this time span. | |
![]() ![]() |
FTimespan | operator- () |
Return the inverse of this time span. |
![]() ![]() |
bool | operator!=
(
const FTimespan& Other |
Compare this time span with the given time span for inequality. |
![]() ![]() |
FTimespan | Return the result of calculating the modulus of this time span with another time span. | |
![]() |
FTimespan & | operator%=
(
const FTimespan& Other |
Calculate this time span modulo another. |
![]() ![]() |
FTimespan | operator*
(
double Scalar |
Return the result of multiplying the this time span with the given scalar. |
![]() |
FTimespan & | operator*=
(
double Scalar |
Multiply this time span with the given scalar. |
![]() ![]() |
FTimespan | operator/
(
double Scalar |
Return the result of dividing the this time span by the given scalar. |
![]() |
FTimespan & | operator/=
(
double Scalar |
Divide this time span by the given scalar. |
![]() ![]() |
FTimespan | Return the result of adding the given time span to this time span. | |
![]() |
FTimespan & | operator+=
(
const FTimespan& Other |
Adds the given time span to this time span. |
![]() ![]() |
bool | Check whether this time span is less than the given time span. | |
![]() ![]() |
bool | operator<=
(
const FTimespan& Other |
Check whether this time span is less than or equal to the given time span. |
![]() |
FTimespan & | operator-=
(
const FTimespan& Other |
Subtract the given time span from this time span. |
![]() ![]() |
bool | operator==
(
const FTimespan& Other |
Compare this time span with the given time span for equality. |
![]() ![]() |
bool | Check whether this time span is greater than the given time span. | |
![]() ![]() |
bool | operator>=
(
const FTimespan& Other |
Check whether this time span is greater than or equal to the given time span. |