engine
 
载入中...
搜索中...
未找到
Public 成员函数 | 静态 Public 成员函数 | Protected 成员函数 | 友元 | 所有成员列表
FTimespan结构体 参考

Implements a time span. 更多...

#include <Timespan.h>

Public 成员函数

CORE_API bool ExportTextItem (FString &ValueStr, FTimespan const &DefaultValue, UObject *Parent, int32 PortFlags, UObject *ExportRootScope) const
 Export this time span value to a string. 更多...
 
 FTimespan ()
 Default constructor (no initialization).
 
 FTimespan (int32 Days, int32 Hours, int32 Minutes, int32 Seconds)
 Create and initialize a new time interval with the specified number of days, hours, minutes and seconds. 更多...
 
 FTimespan (int32 Days, int32 Hours, int32 Minutes, int32 Seconds, int32 FractionNano)
 Create and initialize a new time interval with the specified number of days, hours, minutes and seconds. 更多...
 
 FTimespan (int32 Hours, int32 Minutes, int32 Seconds)
 Create and initialize a new time interval with the specified number of hours, minutes and seconds. 更多...
 
 FTimespan (int64 InTicks)
 Create and initialize a new time interval with the specified number of ticks. 更多...
 
int32 GetDays () const
 Get the days component of this time span. 更多...
 
FTimespan GetDuration ()
 Get a time span with the absolute value of this time span. 更多...
 
int32 GetFractionMicro () const
 Gets the fractional seconds (in microsecond resolution). 更多...
 
int32 GetFractionMilli () const
 Gets the fractional seconds (in millisecond resolution). 更多...
 
int32 GetFractionNano () const
 Gets the fractional seconds (in nanosecond resolution). 更多...
 
int32 GetFractionTicks () const
 Gets the fractional ticks (in 100 nanosecond resolution). 更多...
 
int32 GetHours () const
 Gets the hours component of this time span. 更多...
 
int32 GetMinutes () const
 Get the minutes component of this time span. 更多...
 
int32 GetSeconds () const
 Get the seconds component of this time span. 更多...
 
int64 GetTicks () const
 Get the number of ticks represented by this time span. 更多...
 
double GetTotalDays () const
 Get the total number of days represented by this time span. 更多...
 
double GetTotalHours () const
 Get the total number of hours represented by this time span. 更多...
 
double GetTotalMicroseconds () const
 Get the total number of microseconds represented by this time span. 更多...
 
double GetTotalMilliseconds () const
 Get the total number of milliseconds represented by this time span. 更多...
 
double GetTotalMinutes () const
 Get the total number of minutes represented by this time span. 更多...
 
double GetTotalSeconds () const
 Get the total number of seconds represented by this time span. 更多...
 
CORE_API bool ImportTextItem (const TCHAR *&Buffer, int32 PortFlags, UObject *Parent, FOutputDevice *ErrorText)
 Import a time span value from a text buffer. 更多...
 
bool IsZero () const
 Check whether this time span is zero. 更多...
 
CORE_API bool NetSerialize (FArchive &Ar, class UPackageMap *Map, bool &bOutSuccess)
 Serializes this date and time for network transmission
 
bool operator!= (const FTimespan &Other) const
 Compare this time span with the given time span for inequality. 更多...
 
FTimespan operator% (const FTimespan &Other) const
 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) const
 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+ (const FTimespan &Other) const
 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. 更多...
 
FTimespan operator- () const
 Return the inverse of this time span. 更多...
 
FTimespan operator- (const FTimespan &Other) const
 Return the result of subtracting the given time span from this time span. 更多...
 
FTimespan & operator-= (const FTimespan &Other)
 Subtract the given time span from this time span. 更多...
 
FTimespan operator/ (double Scalar) const
 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. 更多...
 
bool operator< (const FTimespan &Other) const
 Check whether this time span is less than the given time span. 更多...
 
bool operator<= (const FTimespan &Other) const
 Check whether this time span is less than or equal to the given time span. 更多...
 
bool operator== (const FTimespan &Other) const
 Compare this time span with the given time span for equality. 更多...
 
bool operator> (const FTimespan &Other) const
 Check whether this time span is greater than the given time span. 更多...
 
bool operator>= (const FTimespan &Other) const
 Check whether this time span is greater than or equal to the given time span. 更多...
 
CORE_API bool Serialize (FArchive &Ar)
 Serialize this time span from or into the specified archive. 更多...
 
CORE_API FString ToString () const
 Return the string representation of this time span using a default format. 更多...
 
CORE_API FString ToString (const TCHAR *Format) const
 Convert this time span to its string representation. 更多...
 

静态 Public 成员函数

static FTimespan FromDays (double Days)
 Create a time span that represents the specified number of days. 更多...
 
static FTimespan FromHours (double Hours)
 Create a time span that represents the specified number of hours. 更多...
 
static FTimespan FromMicroseconds (double Microseconds)
 Create a time span that represents the specified number of microseconds. 更多...
 
static FTimespan FromMilliseconds (double Milliseconds)
 Create a time span that represents the specified number of milliseconds. 更多...
 
static FTimespan FromMinutes (double Minutes)
 Create a time span that represents the specified number of minutes. 更多...
 
static FTimespan FromSeconds (double Seconds)
 Create a time span that represents the specified number of seconds. 更多...
 
static FTimespan MaxValue ()
 Return the maximum time span value. 更多...
 
static FTimespan MinValue ()
 Return the minimum time span value. 更多...
 
static CORE_API bool Parse (const FString &TimespanString, FTimespan &OutTimespan)
 Convert a string to a time span. 更多...
 
static double Ratio (FTimespan Dividend, FTimespan Divisor)
 Ratio between two time spans (handles zero values). 更多...
 
static FTimespan Zero ()
 Return the zero time span value. 更多...
 

Protected 成员函数

void CORE_API Assign (int32 Days, int32 Hours, int32 Minutes, int32 Seconds, int32 FractionNano)
 Assign the specified components to this time span. 更多...
 

友元

CORE_API uint32 GetTypeHash (const FTimespan &Timespan)
 Get the hash for the specified time span. 更多...
 
CORE_API FArchive & operator<< (FArchive &Ar, FTimespan &Timespan)
 Serialize the given time span from or into the specified archive. 更多...
 
class UObject
 

详细描述

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.

参见
FDateTime

构造及析构函数说明

◆ FTimespan() [1/4]

FTimespan::FTimespan ( int64  InTicks)
inline

Create and initialize a new time interval with the specified number of ticks.

For better readability, consider using MinValue, MaxValue and Zero.

参数
TicksThe number of ticks.
参见
MaxValue, MinValue, Zero

◆ FTimespan() [2/4]

FTimespan::FTimespan ( int32  Hours,
int32  Minutes,
int32  Seconds 
)
inline

Create and initialize a new time interval with the specified number of hours, minutes and seconds.

For better readability, consider using FromHours, FromMinutes and FromSeconds.

参数
HoursThe hours component.
MinutesThe minutes component.
SecondsThe seconds component.
参见
FromHours, FromMinutes, FromSeconds

◆ FTimespan() [3/4]

FTimespan::FTimespan ( int32  Days,
int32  Hours,
int32  Minutes,
int32  Seconds 
)
inline

Create and initialize a new time interval with the specified number of days, hours, minutes and seconds.

For better readability, consider using FromDays, FromHours, FromMinutes and FromSeconds.

参数
DaysThe days component.
HoursThe hours component.
MinutesThe minutes component.
SecondsThe seconds component.
参见
FromDays, FromHours, FromMinutes, FromSeconds

◆ FTimespan() [4/4]

FTimespan::FTimespan ( int32  Days,
int32  Hours,
int32  Minutes,
int32  Seconds,
int32  FractionNano 
)
inline

Create and initialize a new time interval with the specified number of days, hours, minutes and seconds.

参数
DaysThe days component.
HoursThe hours component.
MinutesThe minutes component.
SecondsThe seconds component.
FractionNanoThe fractional seconds (in nanosecond resolution).

成员函数说明

◆ Assign()

void CORE_API FTimespan::Assign ( int32  Days,
int32  Hours,
int32  Minutes,
int32  Seconds,
int32  FractionNano 
)
protected

Assign the specified components to this time span.

参数
DaysThe days component.
HoursThe hours component.
MinutesThe minutes component.
SecondsThe seconds component.
FractionNanoThe fractional seconds (in nanosecond resolution).

◆ ExportTextItem()

CORE_API bool FTimespan::ExportTextItem ( FString &  ValueStr,
FTimespan const &  DefaultValue,
UObject *  Parent,
int32  PortFlags,
UObject *  ExportRootScope 
) const

Export this time span value to a string.

参数
ValueStrWill hold the string value.
DefaultValueThe default value.
ParentNot used.
PortFlagsNot used.
ExportRootScopeNot used.
返回
true on success, false otherwise.
参见
ImportTextItem

◆ FromDays()

static FTimespan FTimespan::FromDays ( double  Days)
inlinestatic

Create a time span that represents the specified number of days.

参数
DaysThe number of days.
返回
Time span.
参见
FromHours, FromMicroseconds, FromMilliseconds, FromMinutes, FromSeconds

◆ FromHours()

static FTimespan FTimespan::FromHours ( double  Hours)
inlinestatic

Create a time span that represents the specified number of hours.

参数
HoursThe number of hours.
返回
Time span.
参见
FromDays, FromMicroseconds, FromMilliseconds, FromMinutes, FromSeconds

◆ FromMicroseconds()

static FTimespan FTimespan::FromMicroseconds ( double  Microseconds)
inlinestatic

Create a time span that represents the specified number of microseconds.

参数
MicrosecondsThe number of microseconds.
返回
Time span.
参见
FromDays, FromHours, FromMinutes, FromSeconds, FromMilliseconds

◆ FromMilliseconds()

static FTimespan FTimespan::FromMilliseconds ( double  Milliseconds)
inlinestatic

Create a time span that represents the specified number of milliseconds.

参数
MillisecondsThe number of milliseconds.
返回
Time span.
参见
FromDays, FromHours, FromMicroseconds, FromMinutes, FromSeconds

◆ FromMinutes()

static FTimespan FTimespan::FromMinutes ( double  Minutes)
inlinestatic

Create a time span that represents the specified number of minutes.

参数
MinutesThe number of minutes.
返回
Time span.
参见
FromDays, FromHours, FromMicroseconds, FromMilliseconds, FromSeconds

◆ FromSeconds()

static FTimespan FTimespan::FromSeconds ( double  Seconds)
inlinestatic

Create a time span that represents the specified number of seconds.

参数
SecondsThe number of seconds.
返回
Time span.
参见
FromDays, FromHours, FromMicroseconds, FromMilliseconds, FromMinutes

◆ GetDays()

int32 FTimespan::GetDays ( ) const
inline

Get the days component of this time span.

返回
Days component.

◆ GetDuration()

FTimespan FTimespan::GetDuration ( )
inline

Get a time span with the absolute value of this time span.

This method may overflow the timespan if its value is equal to MinValue.

返回
Duration of this time span.
参见
MinValue

◆ GetFractionMicro()

int32 FTimespan::GetFractionMicro ( ) const
inline

Gets the fractional seconds (in microsecond resolution).

返回
Number of microseconds in fractional part.
参见
GetTotalMicroseconds

◆ GetFractionMilli()

int32 FTimespan::GetFractionMilli ( ) const
inline

Gets the fractional seconds (in millisecond resolution).

返回
Number of milliseconds in fractional part.
参见
GetTotalMilliseconds

◆ GetFractionNano()

int32 FTimespan::GetFractionNano ( ) const
inline

Gets the fractional seconds (in nanosecond resolution).

返回
Number of nanoseconds in fractional part.

◆ GetFractionTicks()

int32 FTimespan::GetFractionTicks ( ) const
inline

Gets the fractional ticks (in 100 nanosecond resolution).

返回
Number of ticks in fractional part.

◆ GetHours()

int32 FTimespan::GetHours ( ) const
inline

Gets the hours component of this time span.

返回
Hours component.
参见
GetTotalHours

◆ GetMinutes()

int32 FTimespan::GetMinutes ( ) const
inline

Get the minutes component of this time span.

返回
Minutes component.
参见
GetTotalMinutes

◆ GetSeconds()

int32 FTimespan::GetSeconds ( ) const
inline

Get the seconds component of this time span.

返回
Seconds component.
参见
GetTotalSeconds

◆ GetTicks()

int64 FTimespan::GetTicks ( ) const
inline

Get the number of ticks represented by this time span.

返回
Number of ticks.

◆ GetTotalDays()

double FTimespan::GetTotalDays ( ) const
inline

Get the total number of days represented by this time span.

返回
Number of days.
参见
GetDays

◆ GetTotalHours()

double FTimespan::GetTotalHours ( ) const
inline

Get the total number of hours represented by this time span.

返回
Number of hours.
参见
GetHours

◆ GetTotalMicroseconds()

double FTimespan::GetTotalMicroseconds ( ) const
inline

Get the total number of microseconds represented by this time span.

返回
Number of microseconds.
参见
GetFractionMicro

◆ GetTotalMilliseconds()

double FTimespan::GetTotalMilliseconds ( ) const
inline

Get the total number of milliseconds represented by this time span.

返回
Number of milliseconds.
参见
GetFractionMilli

◆ GetTotalMinutes()

double FTimespan::GetTotalMinutes ( ) const
inline

Get the total number of minutes represented by this time span.

返回
Number of minutes.
参见
GetMinutes

◆ GetTotalSeconds()

double FTimespan::GetTotalSeconds ( ) const
inline

Get the total number of seconds represented by this time span.

返回
Number of seconds.
参见
GetSeconds

◆ ImportTextItem()

CORE_API bool FTimespan::ImportTextItem ( const TCHAR *&  Buffer,
int32  PortFlags,
UObject *  Parent,
FOutputDevice *  ErrorText 
)

Import a time span value from a text buffer.

参数
BufferThe text buffer to import from.
PortFlagsNot used.
ParentNot used.
ErrorTextThe output device for error logging.
返回
true on success, false otherwise.
参见
ExportTextItem

◆ IsZero()

bool FTimespan::IsZero ( ) const
inline

Check whether this time span is zero.

返回
true if the time span is zero, false otherwise.
参见
Zero

◆ MaxValue()

static FTimespan FTimespan::MaxValue ( )
inlinestatic

Return the maximum time span value.

The maximum time span value is slightly more than 10,675,199 days.

返回
Maximum time span.
参见
MinValue,Zero

◆ MinValue()

static FTimespan FTimespan::MinValue ( )
inlinestatic

Return the minimum time span value.

The minimum time span value is slightly less than -10,675,199 days.

返回
Minimum time span.
参见
MaxValue, ZeroValue

◆ operator!=()

bool FTimespan::operator!= ( const FTimespan &  Other) const
inline

Compare this time span with the given time span for inequality.

参数
OtherThe time span to compare with.
返回
true if the time spans are not equal, false otherwise.

◆ operator%()

FTimespan FTimespan::operator% ( const FTimespan &  Other) const
inline

Return the result of calculating the modulus of this time span with another time span.

参数
OtherThe time span to divide by.
返回
A time span representing the remainder of the modulus operation.

◆ operator%=()

FTimespan & FTimespan::operator%= ( const FTimespan &  Other)
inline

Calculate this time span modulo another.

参数
OtherThe time span to divide by.
返回
This time span.

◆ operator*()

FTimespan FTimespan::operator* ( double  Scalar) const
inline

Return the result of multiplying the this time span with the given scalar.

参数
ScalarThe scalar to multiply with.
返回
A time span whose value is the product of this time span and the given scalar.

◆ operator*=()

FTimespan & FTimespan::operator*= ( double  Scalar)
inline

Multiply this time span with the given scalar.

参数
ScalarThe scalar to multiply with.
返回
This time span.

◆ operator+()

FTimespan FTimespan::operator+ ( const FTimespan &  Other) const
inline

Return the result of adding the given time span to this time span.

返回
A time span whose value is the sum of this time span and the given time span.

◆ operator+=()

FTimespan & FTimespan::operator+= ( const FTimespan &  Other)
inline

Adds the given time span to this time span.

返回
This time span.

◆ operator-() [1/2]

FTimespan FTimespan::operator- ( ) const
inline

Return the inverse of this time span.

The value of this time span must be greater than FTimespan::MinValue(), or else an overflow will occur.

返回
Inverse of this time span.

◆ operator-() [2/2]

FTimespan FTimespan::operator- ( const FTimespan &  Other) const
inline

Return the result of subtracting the given time span from this time span.

参数
OtherThe time span to compare with.
返回
A time span whose value is the difference of this time span and the given time span.

◆ operator-=()

FTimespan & FTimespan::operator-= ( const FTimespan &  Other)
inline

Subtract the given time span from this time span.

参数
OtherThe time span to subtract.
返回
This time span.

◆ operator/()

FTimespan FTimespan::operator/ ( double  Scalar) const
inline

Return the result of dividing the this time span by the given scalar.

参数
ScalarThe scalar to divide by.
返回
A time span whose value is the quotient of this time span and the given scalar.

◆ operator/=()

FTimespan & FTimespan::operator/= ( double  Scalar)
inline

Divide this time span by the given scalar.

参数
ScalarThe scalar to divide by.
返回
This time span.

◆ operator<()

bool FTimespan::operator< ( const FTimespan &  Other) const
inline

Check whether this time span is less than the given time span.

参数
OtherThe time span to compare with.
返回
true if this time span is less, false otherwise.

◆ operator<=()

bool FTimespan::operator<= ( const FTimespan &  Other) const
inline

Check whether this time span is less than or equal to the given time span.

参数
OtherThe time span to compare with.
返回
true if this time span is less or equal, false otherwise.

◆ operator==()

bool FTimespan::operator== ( const FTimespan &  Other) const
inline

Compare this time span with the given time span for equality.

参数
OtherThe time span to compare with.
返回
true if the time spans are equal, false otherwise.

◆ operator>()

bool FTimespan::operator> ( const FTimespan &  Other) const
inline

Check whether this time span is greater than the given time span.

参数
OtherThe time span to compare with.
返回
true if this time span is greater, false otherwise.

◆ operator>=()

bool FTimespan::operator>= ( const FTimespan &  Other) const
inline

Check whether this time span is greater than or equal to the given time span.

参数
OtherThe time span to compare with.
返回
true if this time span is greater or equal, false otherwise.

◆ Parse()

static CORE_API bool FTimespan::Parse ( const FString &  TimespanString,
FTimespan &  OutTimespan 
)
static

Convert a string to a time span.

The string must be in one of the following formats: p[d.]hh::mm::ss.fff p[d.]hh::mm::ss.uuuuuu p[d.]hh::mm::ss.nnnnnnnnn

Note that 'p' is the plus or minus sign, and the date component may be omitted for time spans that are shorter than one day.

参数
TimespanStringThe string to convert.
OutTimespanWill contain the parsed time span.
返回
true if the string was converted successfully, false otherwise.
参见
ToString

◆ Ratio()

static double FTimespan::Ratio ( FTimespan  Dividend,
FTimespan  Divisor 
)
inlinestatic

Ratio between two time spans (handles zero values).

参数
DividendThe dividend.
DivisorThe divisor.
返回
The quotient, i.e. Dividend / Divisor.

◆ Serialize()

CORE_API bool FTimespan::Serialize ( FArchive &  Ar)

Serialize this time span from or into the specified archive.

参数
ArThe archive to serialize from or into.
返回
true on success, false otherwise.

◆ ToString() [1/2]

CORE_API FString FTimespan::ToString ( ) const

Return the string representation of this time span using a default format.

The returned string has the following format: p[d.]hh:mm:ss.fff

Note that 'p' is the plus or minus sign, and the date component is omitted for time spans that are shorter than one day.

Examples: -42.15:11:36.457 (45 days, 15 hours, 11 minutes, 36.457 seconds in the past) +42.15:11:36.457 (45 days, 15 hours, 11 minutes, 36.457 seconds in the future) +15:11:36.457 (15 hours, 11 minutes, 36.457 seconds in the future) +00:11:36.457 (11 minutes, 36.457 seconds in the future) +00:00:36.457 (36.457 seconds in the future)

返回
String representation.
参见
Parse

◆ ToString() [2/2]

CORE_API FString FTimespan::ToString ( const TCHAR *  Format) const

Convert this time span to its string representation.

The following formatting codes are available: d - prints the days component D - prints the zero-padded days component (00000000..10675199) h - prints the zero-padded hours component (00..23) m - prints the zero-padded minutes component (00..59) s - prints the zero-padded seconds component (00..59) f - prints the zero-padded fractional seconds (000..999) u - prints the zero-padded fractional seconds (000000..999999) n - prints the zero-padded fractional seconds (000000000..999999999)

Depending on whether the time span is positive or negative, a plus or minus sign character will always be added in front of the generated string.

参数
FormatThe format of the returned string.
返回
String representation.
参见
Parse

◆ Zero()

static FTimespan FTimespan::Zero ( )
inlinestatic

Return the zero time span value.

The zero time span value can be used in comparison operations with other time spans.

返回
Zero time span.
参见
IsZero, MaxValue, MinValue

友元及相关函数文档

◆ GetTypeHash

CORE_API uint32 GetTypeHash ( const FTimespan &  Timespan)
friend

Get the hash for the specified time span.

参数
TimespanThe timespan to get the hash for.
返回
Hash value.

◆ operator<<

CORE_API FArchive & operator<< ( FArchive &  Ar,
FTimespan &  Timespan 
)
friend

Serialize the given time span from or into the specified archive.

参数
ArThe archive to serialize from or into.
TimespanThe time span value to serialize.
返回
The archive.

该结构体的文档由以下文件生成: