OnixS C++ ICE Binary Order Entry Handler 1.0.0
API Documentation
Loading...
Searching...
No Matches
TimeSpan Class Reference

Public Types

typedef Int64 Ticks
typedef Int32 Days
typedef Int32 Hours
typedef Int32 Minutes
typedef Int32 Seconds
typedef Int32 Milliseconds
typedef Int32 Microseconds
typedef Int32 Nanoseconds

Public Member Functions

std::string toString (TimeSpanFormat::Enum=TimeSpanFormat::SDHHMMSSnsec) const
constexpr TimeSpan (Ticks ticks=0) noexcept
 TimeSpan (Days days, Hours hours, Minutes minutes, Seconds seconds, Nanoseconds nanoseconds) noexcept
 TimeSpan (Hours hours, Minutes minutes, Seconds seconds, Nanoseconds nanoseconds) noexcept
Days days () const noexcept
Hours hours () const noexcept
Minutes minutes () const noexcept
Seconds seconds () const noexcept
Milliseconds milliseconds () const noexcept
Microseconds microseconds () const noexcept
Nanoseconds nanoseconds () const noexcept
Ticks ticks () const noexcept
TimeSpanoperator+= (const TimeSpan &other) noexcept
TimeSpanoperator-= (const TimeSpan &other) noexcept
void swap (TimeSpan &other) noexcept

Static Public Member Functions

static TimeSpan fromStr (const std::string &)
static TimeSpan fromStr (StrRef)

Detailed Description

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

Definition at line 146 of file Time.h.

Member Typedef Documentation

◆ Days

typedef Int32 Days

Integral type for number of days.

Definition at line 153 of file Time.h.

◆ Hours

typedef Int32 Hours

Integral type for number of hours.

Definition at line 156 of file Time.h.

◆ Microseconds

Integral type for number of microseconds.

Definition at line 168 of file Time.h.

◆ Milliseconds

Integral type for number of milliseconds.

Definition at line 165 of file Time.h.

◆ Minutes

typedef Int32 Minutes

Integral type for number of minutes.

Definition at line 159 of file Time.h.

◆ Nanoseconds

typedef Int32 Nanoseconds

Integral type for number of nanoseconds.

Definition at line 171 of file Time.h.

◆ Seconds

typedef Int32 Seconds

Integral type for number of seconds.

Definition at line 162 of file Time.h.

◆ Ticks

typedef Int64 Ticks

Integral type presenting internal ticks.

Definition at line 150 of file Time.h.

Constructor & Destructor Documentation

◆ TimeSpan() [1/3]

TimeSpan ( Ticks ticks = 0)
inlineexplicitconstexprnoexcept

Initializes the timespan from the given number of ticks.

Definition at line 178 of file Time.h.

◆ TimeSpan() [2/3]

TimeSpan ( Days days,
Hours hours,
Minutes minutes,
Seconds seconds,
Nanoseconds nanoseconds )
inlinenoexcept

Initializes with the 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.

Definition at line 190 of file Time.h.

◆ TimeSpan() [3/3]

TimeSpan ( Hours hours,
Minutes minutes,
Seconds seconds,
Nanoseconds nanoseconds )
inlinenoexcept

Initializes with the 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.

Definition at line 211 of file Time.h.

Member Function Documentation

◆ days()

Days days ( ) const
inlinenoexcept
Returns
the Days component of the time interval.

Definition at line 224 of file Time.h.

◆ fromStr() [1/2]

TimeSpan fromStr ( const std::string & str)
inlinestatic

De-serializes the timespan from the given string according to the specified pattern.

Exceptions
std::runtime_errorif the de-serialization is impossible.

Definition at line 866 of file Time.h.

◆ fromStr() [2/2]

TimeSpan fromStr ( StrRef str)
inlinestatic

Definition at line 872 of file Time.h.

◆ hours()

Hours hours ( ) const
inlinenoexcept
Returns
the Hours component of the time interval.

Values are in range from -23 through 23.

Definition at line 235 of file Time.h.

◆ microseconds()

Microseconds microseconds ( ) const
inlinenoexcept
Returns
the Microseconds component of the time interval.

Values are in range from -999999 through 999999.

Definition at line 287 of file Time.h.

◆ milliseconds()

Milliseconds milliseconds ( ) const
inlinenoexcept
Returns
the Milliseconds component of the time interval.

Values are in range from -999 through 999.

Definition at line 274 of file Time.h.

◆ minutes()

Minutes minutes ( ) const
inlinenoexcept
Returns
the Minutes component of the time interval.

Values are in range from -59 through 59.

Definition at line 248 of file Time.h.

◆ nanoseconds()

Nanoseconds nanoseconds ( ) const
inlinenoexcept
Returns
the Nanoseconds component of the time interval.

Values are in range from -999999999 through 999999999.

Definition at line 300 of file Time.h.

◆ operator+=()

TimeSpan & operator+= ( const TimeSpan & other)
inlinenoexcept

Adds the given time interval.

Definition at line 318 of file Time.h.

◆ operator-=()

TimeSpan & operator-= ( const TimeSpan & other)
inlinenoexcept

Subtracts the given time interval.

Definition at line 326 of file Time.h.

◆ seconds()

Seconds seconds ( ) const
inlinenoexcept
Returns
the Seconds component of the time interval.

Values are in range from -59 through 59.

Definition at line 261 of file Time.h.

◆ swap()

void swap ( TimeSpan & other)
inlinenoexcept

Swaps.

Definition at line 334 of file Time.h.

◆ ticks()

Ticks ticks ( ) const
inlinenoexcept
Returns
the number of ticks in the time interval.

Ticks are the lowest time quantity used to measure time intervals. In the current implementation ticks are nanoseconds.

Definition at line 312 of file Time.h.

◆ toString()

std::string toString ( TimeSpanFormat::Enum format = TimeSpanFormat::SDHHMMSSnsec) const
inline
Returns
a human-readable presentation.

Definition at line 886 of file Time.h.