OnixS CME Drop Copy Handler C++ library 5.7.1
API documentation
Loading...
Searching...
No Matches
TimeSpan Class Reference

Public Member Functions

 TimeSpan ()
 TimeSpan (Int32 hours, Int32 minutes, Int32 seconds, Int32 nanoseconds=0)
 TimeSpan (Int32 days, Int32 hours, Int32 minutes, Int32 seconds, Int32 nanoseconds)
 TimeSpan (Int64 totalSeconds, Int32 nanoseconds)
 TimeSpan (const TimeSpan &other)
Int64 totalSeconds () const
Int64 totalSubseconds (Subsecond subsecondType) const
Int32 days () const
Int32 hours () const
Int32 minutes () const
Int32 seconds () const
Int32 milliseconds () const
Int32 microseconds () const
Int32 nanoseconds () const
bool operator== (const TimeSpan &other) const
bool operator!= (const TimeSpan &other) const
bool operator< (const TimeSpan &other) const
bool operator> (const TimeSpan &other) const
TimeSpanoperator+= (const TimeSpan &other)
TimeSpanoperator-= (const TimeSpan &other)
TimeSpanoperator= (const TimeSpan &other)
void toString (std::string &str, TimeSpanFormat format=TimeSpanFormats::SDHHMMSSnsec) const
std::string toString (TimeSpanFormat format=TimeSpanFormats::SDHHMMSSnsec) const

Static Public Member Functions

static TimeSpan deserialize (const std::string &str)

Static Public Attributes

static const TimeSpan Zero

Detailed Description

Represents time interval. Used primarily to present time-only stamps and to measure time intervals between two timestamps.

Definition at line 70 of file Time.h.

Constructor & Destructor Documentation

◆ TimeSpan() [1/5]

TimeSpan ( )

Initializes zero span.

◆ TimeSpan() [2/5]

TimeSpan ( Int32 hours,
Int32 minutes,
Int32 seconds,
Int32 nanoseconds = 0 )

Initializes with given set of values. Input parameters are treated as quantities, but not as a time stamp. Therefore, there's no requirement to fit in a certain range like hours must fit into [0, 24) range. After initialization time span will be normalized.

◆ TimeSpan() [3/5]

TimeSpan ( Int32 days,
Int32 hours,
Int32 minutes,
Int32 seconds,
Int32 nanoseconds )

Initializes with given set of values. Input parameters are treated as quantities, but not as a time stamp. Therefore, there's no requirement to fit in a certain range like hours must fit into [0, 24) range. After initialization time span will be normalized.

◆ TimeSpan() [4/5]

TimeSpan ( Int64 totalSeconds,
Int32 nanoseconds )

Initializes time interval from total number seconds and its fractional (nanosecond) part.

◆ TimeSpan() [5/5]

TimeSpan ( const TimeSpan & other)

Initializes as clone of other instance.

Member Function Documentation

◆ days()

Int32 days ( ) const

Days component of time interval. Whole number of days in time interval.

◆ deserialize()

TimeSpan deserialize ( const std::string & str)
static

De-serializes time interval from its text presentation.

◆ hours()

Int32 hours ( ) const

Hours component of time interval. Values are in range from -23 through 23.

◆ microseconds()

Int32 microseconds ( ) const

Microseconds component of time interval. Values are in range from -999999 through 999999.

◆ milliseconds()

Int32 milliseconds ( ) const

Milliseconds component of time interval. Values are in range from -999 through 999.

◆ minutes()

Int32 minutes ( ) const

Minutes component of time interval. Values are in range from -59 through 59.

◆ nanoseconds()

Int32 nanoseconds ( ) const
inline

Nanoseconds component of time interval. Values are in range from -999999999 through 999999999.

Definition at line 178 of file Time.h.

◆ operator!=()

bool operator!= ( const TimeSpan & other) const

Compares with other instance for in-equality.

◆ operator+=()

TimeSpan & operator+= ( const TimeSpan & other)

Adds time interval to current one.

◆ operator-=()

TimeSpan & operator-= ( const TimeSpan & other)

Subtracts time interval from current one.

◆ operator<()

bool operator< ( const TimeSpan & other) const

Checks whether time interval less than other one.

◆ operator=()

TimeSpan & operator= ( const TimeSpan & other)

Re-assigns time interval from other one.

◆ operator==()

bool operator== ( const TimeSpan & other) const

Compares with other instance for equality.

◆ operator>()

bool operator> ( const TimeSpan & other) const

Checks whether time interval greater than other one.

◆ seconds()

Int32 seconds ( ) const

Seconds component of time interval. Values are in range from -59 through 59.

◆ toString() [1/2]

void toString ( std::string & str,
TimeSpanFormat format = TimeSpanFormats::SDHHMMSSnsec ) const

Serializes time stamp into text presentation using specified time-span presentation format.

◆ toString() [2/2]

std::string toString ( TimeSpanFormat format = TimeSpanFormats::SDHHMMSSnsec) const
inline

Serializes time stamp into text presentation using specified time-span presentation format.

Definition at line 183 of file Time.h.

◆ totalSeconds()

Int64 totalSeconds ( ) const
inline

Whole number of seconds in time interval.

Definition at line 173 of file Time.h.

◆ totalSubseconds()

Int64 totalSubseconds ( Subsecond subsecondType) const

Whole number of subseconds in time interval.

Member Data Documentation

◆ Zero

const TimeSpan Zero
static

Time interval of zero length.

Definition at line 166 of file Time.h.