Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
FTimespan Struct Reference

#include <Timespan.h>

Public Member Functions

 FTimespan ()
 
 FTimespan (int64 InTicks)
 
 FTimespan (int32 Hours, int32 Minutes, int32 Seconds)
 
 FTimespan (int32 Days, int32 Hours, int32 Minutes, int32 Seconds)
 
 FTimespan (int32 Days, int32 Hours, int32 Minutes, int32 Seconds, int32 FractionNano)
 
FTimespan operator+ (const FTimespan &Other) const
 
FTimespanoperator+= (const FTimespan &Other)
 
FTimespan operator- () const
 
FTimespan operator- (const FTimespan &Other) const
 
FTimespanoperator-= (const FTimespan &Other)
 
FTimespan operator* (double Scalar) const
 
FTimespanoperator*= (double Scalar)
 
FTimespan operator/ (double Scalar) const
 
FTimespanoperator/= (double Scalar)
 
FTimespan operator% (const FTimespan &Other) const
 
FTimespanoperator%= (const FTimespan &Other)
 
bool operator== (const FTimespan &Other) const
 
bool operator!= (const FTimespan &Other) const
 
bool operator> (const FTimespan &Other) const
 
bool operator>= (const FTimespan &Other) const
 
bool operator< (const FTimespan &Other) const
 
bool operator<= (const FTimespan &Other) const
 
bool ExportTextItem (FString &ValueStr, FTimespan const &DefaultValue, UObject *Parent, int32 PortFlags, UObject *ExportRootScope) const
 
int32 GetDays () const
 
FTimespan GetDuration ()
 
int32 GetFractionMicro () const
 
int32 GetFractionMilli () const
 
int32 GetFractionNano () const
 
int32 GetFractionTicks () const
 
int32 GetHours () const
 
int32 GetMinutes () const
 
int32 GetSeconds () const
 
int64 GetTicks () const
 
double GetTotalDays () const
 
double GetTotalHours () const
 
double GetTotalMicroseconds () const
 
double GetTotalMilliseconds () const
 
double GetTotalMinutes () const
 
double GetTotalSeconds () const
 
bool ImportTextItem (const TCHAR *&Buffer, int32 PortFlags, UObject *Parent, FOutputDevice *ErrorText)
 
bool IsZero () const
 
bool Serialize (FArchive &Ar)
 
bool NetSerialize (FArchive &Ar, class UPackageMap *Map, bool &bOutSuccess)
 
FString ToString () const
 
FString ToString (const TCHAR *Format) const
 

Static Public Member Functions

static FTimespan FromDays (double Days)
 
static FTimespan FromHours (double Hours)
 
static FTimespan FromMicroseconds (double Microseconds)
 
static FTimespan FromMilliseconds (double Milliseconds)
 
static FTimespan FromMinutes (double Minutes)
 
static FTimespan FromSeconds (double Seconds)
 
static FTimespan MaxValue ()
 
static FTimespan MinValue ()
 
static bool Parse (const FString &TimespanString, FTimespan &OutTimespan)
 
static double Ratio (FTimespan Dividend, FTimespan Divisor)
 
static FTimespan Zero ()
 

Protected Member Functions

void Assign (int32 Days, int32 Hours, int32 Minutes, int32 Seconds, int32 FractionNano)
 

Private Attributes

int64 Ticks
 

Friends

struct UObject
 
struct Z_Construct_UScriptStruct_FTimespan_Statics
 
FArchiveoperator<< (FArchive &Ar, FTimespan &Timespan)
 
uint32 GetTypeHash (const FTimespan &Timespan)
 

Detailed Description

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.

See also
FDateTime

Definition at line 75 of file Timespan.h.

Constructor & Destructor Documentation

◆ FTimespan() [1/5]

FTimespan::FTimespan ( )
inline

Default constructor (zero initialization).

Definition at line 80 of file Timespan.h.

◆ FTimespan() [2/5]

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.

Parameters
TicksThe number of ticks.
See also
MaxValue, MinValue, Zero

Definition at line 92 of file Timespan.h.

+ Here is the caller graph for this function:

◆ FTimespan() [3/5]

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.

Parameters
HoursThe hours component.
MinutesThe minutes component.
SecondsThe seconds component.
See also
FromHours, FromMinutes, FromSeconds

Definition at line 108 of file Timespan.h.

+ Here is the call graph for this function:

◆ FTimespan() [4/5]

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.

Parameters
DaysThe days component.
HoursThe hours component.
MinutesThe minutes component.
SecondsThe seconds component.
See also
FromDays, FromHours, FromMinutes, FromSeconds

Definition at line 124 of file Timespan.h.

+ Here is the call graph for this function:

◆ FTimespan() [5/5]

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.

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

Definition at line 138 of file Timespan.h.

+ Here is the call graph for this function:

Member Function Documentation

◆ Assign()

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

Assign the specified components to this time span.

Parameters
DaysThe days component.
HoursThe hours component.
MinutesThe minutes component.
SecondsThe seconds component.
FractionNanoThe fractional seconds (in nanosecond resolution).
+ Here is the caller graph for this function:

◆ ExportTextItem()

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

Export this time span value to a string.

Parameters
ValueStrWill hold the string value.
DefaultValueThe default value.
ParentNot used.
PortFlagsNot used.
ExportRootScopeNot used.
Returns
true on success, false otherwise.
See also
ImportTextItem

◆ FromDays()

static FTimespan FTimespan::FromDays ( double Days)
inlinestatic

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

Parameters
DaysThe number of days.
Returns
Time span.
See also
FromHours, FromMicroseconds, FromMilliseconds, FromMinutes, FromSeconds

Definition at line 613 of file Timespan.h.

◆ FromHours()

static FTimespan FTimespan::FromHours ( double Hours)
inlinestatic

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

Parameters
HoursThe number of hours.
Returns
Time span.
See also
FromDays, FromMicroseconds, FromMilliseconds, FromMinutes, FromSeconds

Definition at line 625 of file Timespan.h.

◆ FromMicroseconds()

static FTimespan FTimespan::FromMicroseconds ( double Microseconds)
inlinestatic

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

Parameters
MicrosecondsThe number of microseconds.
Returns
Time span.
See also
FromDays, FromHours, FromMinutes, FromSeconds, FromMilliseconds

Definition at line 637 of file Timespan.h.

◆ FromMilliseconds()

static FTimespan FTimespan::FromMilliseconds ( double Milliseconds)
inlinestatic

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

Parameters
MillisecondsThe number of milliseconds.
Returns
Time span.
See also
FromDays, FromHours, FromMicroseconds, FromMinutes, FromSeconds

Definition at line 649 of file Timespan.h.

◆ FromMinutes()

static FTimespan FTimespan::FromMinutes ( double Minutes)
inlinestatic

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

Parameters
MinutesThe number of minutes.
Returns
Time span.
See also
FromDays, FromHours, FromMicroseconds, FromMilliseconds, FromSeconds

Definition at line 661 of file Timespan.h.

◆ FromSeconds()

static FTimespan FTimespan::FromSeconds ( double Seconds)
inlinestatic

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

Parameters
SecondsThe number of seconds.
Returns
Time span.
See also
FromDays, FromHours, FromMicroseconds, FromMilliseconds, FromMinutes

Definition at line 673 of file Timespan.h.

+ Here is the caller graph for this function:

◆ GetDays()

int32 FTimespan::GetDays ( ) const
inline

Get the days component of this time span.

Returns
Days component.

Definition at line 356 of file Timespan.h.

◆ 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.

Returns
Duration of this time span.
See also
MinValue

Definition at line 369 of file Timespan.h.

+ Here is the call graph for this function:

◆ GetFractionMicro()

int32 FTimespan::GetFractionMicro ( ) const
inline

Gets the fractional seconds (in microsecond resolution).

Returns
Number of microseconds in fractional part.
See also
GetTotalMicroseconds

Definition at line 380 of file Timespan.h.

◆ GetFractionMilli()

int32 FTimespan::GetFractionMilli ( ) const
inline

Gets the fractional seconds (in millisecond resolution).

Returns
Number of milliseconds in fractional part.
See also
GetTotalMilliseconds

Definition at line 391 of file Timespan.h.

◆ GetFractionNano()

int32 FTimespan::GetFractionNano ( ) const
inline

Gets the fractional seconds (in nanosecond resolution).

Returns
Number of nanoseconds in fractional part.

Definition at line 401 of file Timespan.h.

◆ GetFractionTicks()

int32 FTimespan::GetFractionTicks ( ) const
inline

Gets the fractional ticks (in 100 nanosecond resolution).

Returns
Number of ticks in fractional part.

Definition at line 411 of file Timespan.h.

◆ GetHours()

int32 FTimespan::GetHours ( ) const
inline

Gets the hours component of this time span.

Returns
Hours component.
See also
GetTotalHours

Definition at line 422 of file Timespan.h.

◆ GetMinutes()

int32 FTimespan::GetMinutes ( ) const
inline

Get the minutes component of this time span.

Returns
Minutes component.
See also
GetTotalMinutes

Definition at line 433 of file Timespan.h.

◆ GetSeconds()

int32 FTimespan::GetSeconds ( ) const
inline

Get the seconds component of this time span.

Returns
Seconds component.
See also
GetTotalSeconds

Definition at line 444 of file Timespan.h.

◆ GetTicks()

int64 FTimespan::GetTicks ( ) const
inline

Get the number of ticks represented by this time span.

Returns
Number of ticks.

Definition at line 454 of file Timespan.h.

+ Here is the caller graph for this function:

◆ GetTotalDays()

double FTimespan::GetTotalDays ( ) const
inline

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

Returns
Number of days.
See also
GetDays

Definition at line 465 of file Timespan.h.

+ Here is the caller graph for this function:

◆ GetTotalHours()

double FTimespan::GetTotalHours ( ) const
inline

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

Returns
Number of hours.
See also
GetHours

Definition at line 476 of file Timespan.h.

◆ GetTotalMicroseconds()

double FTimespan::GetTotalMicroseconds ( ) const
inline

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

Returns
Number of microseconds.
See also
GetFractionMicro

Definition at line 487 of file Timespan.h.

◆ GetTotalMilliseconds()

double FTimespan::GetTotalMilliseconds ( ) const
inline

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

Returns
Number of milliseconds.
See also
GetFractionMilli

Definition at line 498 of file Timespan.h.

◆ GetTotalMinutes()

double FTimespan::GetTotalMinutes ( ) const
inline

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

Returns
Number of minutes.
See also
GetMinutes

Definition at line 509 of file Timespan.h.

◆ GetTotalSeconds()

double FTimespan::GetTotalSeconds ( ) const
inline

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

Returns
Number of seconds.
See also
GetSeconds

Definition at line 520 of file Timespan.h.

+ Here is the caller graph for this function:

◆ ImportTextItem()

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

Import a time span value from a text buffer.

Parameters
BufferThe text buffer to import from.
PortFlagsNot used.
ParentNot used.
ErrorTextThe output device for error logging.
Returns
true on success, false otherwise.
See also
ExportTextItem

◆ IsZero()

bool FTimespan::IsZero ( ) const
inline

Check whether this time span is zero.

Returns
true if the time span is zero, false otherwise.
See also
Zero

Definition at line 543 of file Timespan.h.

◆ 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.

Returns
Maximum time span.
See also
MinValue,Zero

Definition at line 686 of file Timespan.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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.

Returns
Minimum time span.
See also
MaxValue, ZeroValue

Definition at line 699 of file Timespan.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NetSerialize()

bool FTimespan::NetSerialize ( FArchive & Ar,
class UPackageMap * Map,
bool & bOutSuccess )

Serializes this date and time for network transmission

◆ operator!=()

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

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

Parameters
OtherThe time span to compare with.
Returns
true if the time spans are not equal, false otherwise.

Definition at line 287 of file Timespan.h.

◆ operator%()

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

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

Parameters
OtherThe time span to divide by.
Returns
A time span representing the remainder of the modulus operation.

Definition at line 253 of file Timespan.h.

+ Here is the call graph for this function:

◆ operator%=()

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

Calculate this time span modulo another.

Parameters
OtherThe time span to divide by.
Returns
This time span.

Definition at line 264 of file Timespan.h.

◆ operator*()

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

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

Parameters
ScalarThe scalar to multiply with.
Returns
A time span whose value is the product of this time span and the given scalar.

Definition at line 207 of file Timespan.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator*=()

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

Multiply this time span with the given scalar.

Parameters
ScalarThe scalar to multiply with.
Returns
This time span.

Definition at line 218 of file Timespan.h.

◆ operator+()

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

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

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

Definition at line 150 of file Timespan.h.

+ Here is the call graph for this function:

◆ operator+=()

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

Adds the given time span to this time span.

Returns
This time span.

Definition at line 160 of file Timespan.h.

◆ 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.

Returns
Inverse of this time span.

Definition at line 173 of file Timespan.h.

+ Here is the call graph for this function:

◆ operator-() [2/2]

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

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

Parameters
OtherThe time span to compare with.
Returns
A time span whose value is the difference of this time span and the given time span.

Definition at line 184 of file Timespan.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator-=()

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

Subtract the given time span from this time span.

Parameters
OtherThe time span to subtract.
Returns
This time span.

Definition at line 195 of file Timespan.h.

◆ operator/()

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

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

Parameters
ScalarThe scalar to divide by.
Returns
A time span whose value is the quotient of this time span and the given scalar.

Definition at line 230 of file Timespan.h.

+ Here is the call graph for this function:

◆ operator/=()

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

Divide this time span by the given scalar.

Parameters
ScalarThe scalar to divide by.
Returns
This time span.

Definition at line 241 of file Timespan.h.

◆ operator<()

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

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

Parameters
OtherThe time span to compare with.
Returns
true if this time span is less, false otherwise.

Definition at line 320 of file Timespan.h.

◆ operator<=()

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

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

Parameters
OtherThe time span to compare with.
Returns
true if this time span is less or equal, false otherwise.

Definition at line 331 of file Timespan.h.

◆ operator==()

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

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

Parameters
OtherThe time span to compare with.
Returns
true if the time spans are equal, false otherwise.

Definition at line 276 of file Timespan.h.

+ Here is the caller graph for this function:

◆ operator>()

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

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

Parameters
OtherThe time span to compare with.
Returns
true if this time span is greater, false otherwise.

Definition at line 298 of file Timespan.h.

◆ operator>=()

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

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

Parameters
OtherThe time span to compare with.
Returns
true if this time span is greater or equal, false otherwise.

Definition at line 309 of file Timespan.h.

+ Here is the caller graph for this function:

◆ Parse()

static 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.

Parameters
TimespanStringThe string to convert.
OutTimespanWill contain the parsed time span.
Returns
true if the string was converted successfully, false otherwise.
See also
ToString

◆ Ratio()

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

Ratio between two time spans (handles zero values).

Parameters
DividendThe dividend.
DivisorThe divisor.
Returns
The quotient, i.e. Dividend / Divisor.

Definition at line 729 of file Timespan.h.

+ Here is the call graph for this function:

◆ Serialize()

bool FTimespan::Serialize ( FArchive & Ar)

Serialize this time span from or into the specified archive.

Parameters
ArThe archive to serialize from or into.
Returns
true on success, false otherwise.

◆ ToString() [1/2]

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)

Returns
String representation.
See also
Parse

◆ ToString() [2/2]

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.

Parameters
FormatThe format of the returned string.
Returns
String representation.
See also
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.

Returns
Zero time span.
See also
IsZero, MaxValue, MinValue

Definition at line 747 of file Timespan.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ GetTypeHash

uint32 GetTypeHash ( const FTimespan & Timespan)
friend

Get the hash for the specified time span.

Parameters
TimespanThe timespan to get the hash for.
Returns
Hash value.

◆ operator<<

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

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

Parameters
ArThe archive to serialize from or into.
TimespanThe time span value to serialize.
Returns
The archive.

◆ UObject

Definition at line 754 of file Timespan.h.

◆ Z_Construct_UScriptStruct_FTimespan_Statics

friend struct Z_Construct_UScriptStruct_FTimespan_Statics
friend

Definition at line 787 of file Timespan.h.

Member Data Documentation

◆ Ticks

int64 FTimespan::Ticks
private

The time span value in 100 nanoseconds resolution.

Definition at line 792 of file Timespan.h.


The documentation for this struct was generated from the following file: