CTR Pia  4.11.3
Game Communication Engine
nn::pia::common::TimeSpan Class Reference

Class for representing time spans. This class can perform type conversions with numeric values in milliseconds. More...

+ Inheritance diagram for nn::pia::common::TimeSpan:

Public Member Functions

 TimeSpan ()
 Default constructor.
 
 TimeSpan (s32 msec)
 Constructor that initializes the instance from a numeric value representing milliseconds. More...
 
 TimeSpan (s64 msec)
 Constructor that initializes the instance from a numeric value representing milliseconds. More...
 
 TimeSpan (const TimeSpan &rhs)
 Copy constructor. More...
 
s32 GetMSec () const
 Gets the time in milliseconds as an s32 value. More...
 
s64 GetMSecS64 () const
 Gets the time in milliseconds as an s64 value. More...
 
s32 GetSec () const
 Gets the time in seconds as an s32 value. More...
 
f32 GetSecF32 () const
 Gets the time in seconds as an f32 value. More...
 
s64 GetSecS64 () const
 Gets the time in seconds as an s64 value. More...
 
 operator s32 () const
 An operator that converts a time object to an s32 value in milliseconds. More...
 
 operator s64 () const
 An operator that converts a time object to an s64 value in milliseconds. More...
 
bool operator!= (const TimeSpan &rhs) const
 Equality operator. It determines whether two TimeSpan objects differ. More...
 
bool operator!= (s32 rhs) const
 Equality operator. Determines whether two TimeSpan objects differ. More...
 
bool operator!= (s64 rhs) const
 Equality operator. Determines whether two TimeSpan objects differ. More...
 
TimeSpan operator+ (const TimeSpan &rhs) const
 Calculates a TimeSpan object holding the amount of time added to this instance. More...
 
TimeSpanoperator+= (const TimeSpan &rhs)
 Adds time to this instance. More...
 
TimeSpan operator- (const TimeSpan &rhs) const
 Calculates a TimeSpan object holding the amount of time subtracted from this instance. More...
 
TimeSpanoperator-= (const TimeSpan &rhs)
 Subtracts time from this instance. More...
 
bool operator< (const TimeSpan &rhs) const
 Comparison operator. Returns true if the time represented by this instance is shorter; otherwise, returns false. More...
 
bool operator< (s32 rhs) const
 Comparison operator. Returns true if the time represented by this instance is shorter; otherwise, returns false. More...
 
bool operator< (s64 rhs) const
 Comparison operator. Returns true if the time represented by this instance is shorter; otherwise, returns false. More...
 
bool operator<= (const TimeSpan &rhs) const
 Comparison operator. Returns true if the time represented by this instance is less than or equal, and false otherwise. More...
 
bool operator<= (s32 rhs) const
 Comparison operator. Returns true if the time represented by this instance is less than or equal, and false otherwise. More...
 
bool operator<= (s64 rhs) const
 Comparison operator. Returns true if the time represented by this instance is less than or equal, and false otherwise. More...
 
TimeSpanoperator= (const TimeSpan &rhs)
 Assignment operator. More...
 
TimeSpanoperator= (s32 msec)
 An operator that assigns a numeric value in milliseconds. More...
 
TimeSpanoperator= (s64 msec)
 An operator that assigns a numeric value in milliseconds. More...
 
bool operator== (const TimeSpan &rhs) const
 Equality operator. It determines whether two TimeSpan objects are equal. More...
 
bool operator== (s32 rhs) const
 Equality operator. It determines whether two TimeSpan objects are equal. More...
 
bool operator== (s64 rhs) const
 Equality operator. Determines whether two TimeSpan objects are equal. More...
 
bool operator> (const TimeSpan &rhs) const
 Comparison operator. Returns true if the time represented by this instance is longer; otherwise returns false. More...
 
bool operator> (s32 rhs) const
 Comparison operator. Returns true if the time represented by this instance is longer; otherwise returns false. More...
 
bool operator> (s64 rhs) const
 Comparison operator. Returns true if the time represented by this instance is longer; otherwise returns false. More...
 
bool operator>= (const TimeSpan &rhs) const
 Comparison operator. Returns true if the time represented by this instance is greater than or equal; otherwise returns false. More...
 
bool operator>= (s32 rhs) const
 Comparison operator. Returns true if the time represented by this instance is greater than or equal; otherwise returns false. More...
 
bool operator>= (s64 rhs) const
 Comparison operator. Returns true if the time represented by this instance is greater than or equal; otherwise returns false. More...
 
void SetFromMSec (s32 msec)
 Sets the time in milliseconds from an s32 value. More...
 
void SetFromMSec (s64 msec)
 Sets the time in milliseconds from an s64 value. More...
 
void SetFromSec (s32 sec)
 Sets the time in seconds from an s32 value. More...
 
void SetFromSec (s64 sec)
 Sets the time in seconds from an s64 value. More...
 
void SetFromSec (f32 sec)
 Sets the time in seconds from an f32 value. More...
 
void Trace (u64 flag) const
 Prints information useful for debugging. More...
 

Detailed Description

Class for representing time spans. This class can perform type conversions with numeric values in milliseconds.


Revision History:

2012-07-12 Added support so that this instance can be initialized as a static variable without problems.

2012-05-24 Added the addition and subtraction operators to the TimeSpan class.

2012-04-20 Initial version.

Constructor & Destructor Documentation

nn::pia::common::TimeSpan::TimeSpan ( s32  msec)
inline

Constructor that initializes the instance from a numeric value representing milliseconds.

Parameters
[in]msecSpecifies the initial value, in milliseconds.
nn::pia::common::TimeSpan::TimeSpan ( s64  msec)
inline

Constructor that initializes the instance from a numeric value representing milliseconds.

Parameters
[in]msecSpecifies the initial value, in milliseconds.
nn::pia::common::TimeSpan::TimeSpan ( const TimeSpan rhs)
inline

Copy constructor.

Parameters
[in]rhsA TimeSpan instance that holds the values used to initialize this instance.

Member Function Documentation

s32 nn::pia::common::TimeSpan::GetMSec ( ) const
inline

Gets the time in milliseconds as an s32 value.

Returns
The time in milliseconds.
s64 nn::pia::common::TimeSpan::GetMSecS64 ( ) const
inline

Gets the time in milliseconds as an s64 value.

Returns
The time in milliseconds.
s32 nn::pia::common::TimeSpan::GetSec ( ) const
inline

Gets the time in seconds as an s32 value.

Returns
The time in seconds.
f32 nn::pia::common::TimeSpan::GetSecF32 ( ) const
inline

Gets the time in seconds as an f32 value.

Returns
The time in seconds.
s64 nn::pia::common::TimeSpan::GetSecS64 ( ) const
inline

Gets the time in seconds as an s64 value.

Returns
The time in seconds.
nn::pia::common::TimeSpan::operator s32 ( ) const
inline

An operator that converts a time object to an s32 value in milliseconds.

Returns
The time in milliseconds.
nn::pia::common::TimeSpan::operator s64 ( ) const
inline

An operator that converts a time object to an s64 value in milliseconds.

Returns
The time in milliseconds.
bool nn::pia::common::TimeSpan::operator!= ( const TimeSpan rhs) const
inline

Equality operator. It determines whether two TimeSpan objects differ.

Parameters
[in]rhsThe TimeSpan instance to compare with.
Returns
true if they represent different times, and false otherwise.
bool nn::pia::common::TimeSpan::operator!= ( s32  rhs) const
inline

Equality operator. Determines whether two TimeSpan objects differ.

Parameters
[in]rhsAn s32 value in milliseconds to compare with.
Returns
true if they represent different times, and false otherwise.
bool nn::pia::common::TimeSpan::operator!= ( s64  rhs) const
inline

Equality operator. Determines whether two TimeSpan objects differ.

Parameters
[in]rhsAn s64 value in milliseconds to compare with.
Returns
true if they represent different times, and false otherwise.
TimeSpan nn::pia::common::TimeSpan::operator+ ( const TimeSpan rhs) const
inline

Calculates a TimeSpan object holding the amount of time added to this instance.

Parameters
[in]rhsThe time span to add.
Returns
A Time object representing the amount of time that was added.
TimeSpan& nn::pia::common::TimeSpan::operator+= ( const TimeSpan rhs)
inline

Adds time to this instance.

Parameters
[in]rhsThe time span to add.
Returns
Returns a reference to this instance.
TimeSpan nn::pia::common::TimeSpan::operator- ( const TimeSpan rhs) const
inline

Calculates a TimeSpan object holding the amount of time subtracted from this instance.

Parameters
[in]rhsThe time span to subtract.
Returns
A TimeSpan object representing the amount of time that was subtracted.
TimeSpan& nn::pia::common::TimeSpan::operator-= ( const TimeSpan rhs)
inline

Subtracts time from this instance.

Parameters
[in]rhsThe time span to subtract.
Returns
Returns a reference to this instance.
bool nn::pia::common::TimeSpan::operator< ( const TimeSpan rhs) const
inline

Comparison operator. Returns true if the time represented by this instance is shorter; otherwise, returns false.

Parameters
[in]rhsThe TimeSpan instance to compare with.
Returns
Returns true if the time represented by this instance is shorter, and false otherwise.
bool nn::pia::common::TimeSpan::operator< ( s32  rhs) const
inline

Comparison operator. Returns true if the time represented by this instance is shorter; otherwise, returns false.

Parameters
[in]rhsAn s32 value in milliseconds to compare with.
Returns
Returns true if the time represented by this instance is shorter, and false otherwise.
bool nn::pia::common::TimeSpan::operator< ( s64  rhs) const
inline

Comparison operator. Returns true if the time represented by this instance is shorter; otherwise, returns false.

Parameters
[in]rhsAn s64 value in milliseconds to compare with.
Returns
Returns true if the time represented by this instance is shorter, and false otherwise.
bool nn::pia::common::TimeSpan::operator<= ( const TimeSpan rhs) const
inline

Comparison operator. Returns true if the time represented by this instance is less than or equal, and false otherwise.

Parameters
[in]rhsThe TimeSpan instance to compare with.
Returns
Returns true if the time represented by this instance is less than or equal, and false otherwise.
bool nn::pia::common::TimeSpan::operator<= ( s32  rhs) const
inline

Comparison operator. Returns true if the time represented by this instance is less than or equal, and false otherwise.

Parameters
[in]rhsAn s32 value in milliseconds to compare with.
Returns
Returns true if the time represented by this instance is less than or equal, and false otherwise.
bool nn::pia::common::TimeSpan::operator<= ( s64  rhs) const
inline

Comparison operator. Returns true if the time represented by this instance is less than or equal, and false otherwise.

Parameters
[in]rhsAn s64 value in milliseconds to compare with.
Returns
Returns true if the time represented by this instance is less than or equal, and false otherwise.
TimeSpan& nn::pia::common::TimeSpan::operator= ( const TimeSpan rhs)
inline

Assignment operator.

Parameters
[in]rhsThe TimeSpan instance to assign to this instance.
Returns
Returns a reference to this instance.
TimeSpan& nn::pia::common::TimeSpan::operator= ( s32  msec)
inline

An operator that assigns a numeric value in milliseconds.

Parameters
[in]msecThe time in milliseconds.
Returns
Returns a reference to this instance.
TimeSpan& nn::pia::common::TimeSpan::operator= ( s64  msec)
inline

An operator that assigns a numeric value in milliseconds.

Parameters
[in]msecThe time in milliseconds.
Returns
Returns a reference to this instance.
bool nn::pia::common::TimeSpan::operator== ( const TimeSpan rhs) const
inline

Equality operator. It determines whether two TimeSpan objects are equal.

Parameters
[in]rhsThe TimeSpan instance to compare with.
Returns
Returns true if they represent the same time, and false otherwise.
bool nn::pia::common::TimeSpan::operator== ( s32  rhs) const
inline

Equality operator. It determines whether two TimeSpan objects are equal.

Parameters
[in]rhsAn s32 value in milliseconds to compare with.
Returns
Returns true if they represent the same time, and false otherwise.
bool nn::pia::common::TimeSpan::operator== ( s64  rhs) const
inline

Equality operator. Determines whether two TimeSpan objects are equal.

Parameters
[in]rhsAn s64 value in milliseconds to compare with.
Returns
Returns true if they represent the same time, and false otherwise.
bool nn::pia::common::TimeSpan::operator> ( const TimeSpan rhs) const
inline

Comparison operator. Returns true if the time represented by this instance is longer; otherwise returns false.

Parameters
[in]rhsThe TimeSpan instance to compare with.
Returns
Returns true if the time represented by this instance is longer, and false otherwise.
bool nn::pia::common::TimeSpan::operator> ( s32  rhs) const
inline

Comparison operator. Returns true if the time represented by this instance is longer; otherwise returns false.

Parameters
[in]rhsAn s32 value in milliseconds to compare with.
Returns
Returns true if the time represented by this instance is longer, and false otherwise.
bool nn::pia::common::TimeSpan::operator> ( s64  rhs) const
inline

Comparison operator. Returns true if the time represented by this instance is longer; otherwise returns false.

Parameters
[in]rhsAn s64 value in milliseconds to compare with.
Returns
Returns true if the time represented by this instance is longer, and false otherwise.
bool nn::pia::common::TimeSpan::operator>= ( const TimeSpan rhs) const
inline

Comparison operator. Returns true if the time represented by this instance is greater than or equal; otherwise returns false.

Parameters
[in]rhsThe TimeSpan instance to compare with.
Returns
Returns true if the time represented by this instance is greater than or equal, and false otherwise.
bool nn::pia::common::TimeSpan::operator>= ( s32  rhs) const
inline

Comparison operator. Returns true if the time represented by this instance is greater than or equal; otherwise returns false.

Parameters
[in]rhsAn s32 value in milliseconds to compare with.
Returns
Returns true if the time represented by this instance is greater than or equal, and false otherwise.
bool nn::pia::common::TimeSpan::operator>= ( s64  rhs) const
inline

Comparison operator. Returns true if the time represented by this instance is greater than or equal; otherwise returns false.

Parameters
[in]rhsAn s64 value in milliseconds to compare with.
Returns
Returns true if the time represented by this instance is greater than or equal, and false otherwise.
void nn::pia::common::TimeSpan::SetFromMSec ( s32  msec)
inline

Sets the time in milliseconds from an s32 value.

Parameters
[in]msecThe time in milliseconds.
void nn::pia::common::TimeSpan::SetFromMSec ( s64  msec)
inline

Sets the time in milliseconds from an s64 value.

Parameters
[in]msecThe time in milliseconds.
void nn::pia::common::TimeSpan::SetFromSec ( s32  sec)
inline

Sets the time in seconds from an s32 value.

Parameters
[in]secThe time in seconds.
void nn::pia::common::TimeSpan::SetFromSec ( s64  sec)
inline

Sets the time in seconds from an s64 value.

Parameters
[in]secThe time in seconds.
void nn::pia::common::TimeSpan::SetFromSec ( f32  sec)
inline

Sets the time in seconds from an f32 value.

Parameters
[in]secThe time in seconds.
void nn::pia::common::TimeSpan::Trace ( u64  flag) const

Prints information useful for debugging.

Parameters
[in]flagBitwise OR of trace flags. For more information, see the TraceFlag type.