OnixS C++ CME MDP Conflated TCP Handler 1.3.6
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
 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 &)

Detailed Description

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

Definition at line 145 of file Time.h.

Member Typedef Documentation

◆ Days

typedef Int32 Days

Integral type for number of days.

Definition at line 152 of file Time.h.

◆ Hours

typedef Int32 Hours

Integral type for number of hours.

Definition at line 155 of file Time.h.

◆ Microseconds

Integral type for number of microseconds.

Definition at line 167 of file Time.h.

◆ Milliseconds

Integral type for number of milliseconds.

Definition at line 164 of file Time.h.

◆ Minutes

typedef Int32 Minutes

Integral type for number of minutes.

Definition at line 158 of file Time.h.

◆ Nanoseconds

typedef Int32 Nanoseconds

Integral type for number of nanoseconds.

Definition at line 170 of file Time.h.

◆ Seconds

typedef Int32 Seconds

Integral type for number of seconds.

Definition at line 161 of file Time.h.

◆ Ticks

typedef Int64 Ticks

Integral type presenting internal ticks.

Definition at line 149 of file Time.h.

Constructor & Destructor Documentation

◆ TimeSpan() [1/3]

TimeSpan ( Ticks ticks = 0)
inlineexplicitnoexcept

Initializes the timespan from the given number of ticks.

Definition at line 177 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 189 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 210 of file Time.h.

Member Function Documentation

◆ days()

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

Definition at line 223 of file Time.h.

◆ fromStr()

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 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 234 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 286 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 273 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 247 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 299 of file Time.h.

◆ operator+=()

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

Adds the given time interval.

Definition at line 317 of file Time.h.

◆ operator-=()

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

Subtracts the given time interval.

Definition at line 325 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 260 of file Time.h.

◆ swap()

void swap ( TimeSpan & other)
inlinenoexcept

Swaps.

Definition at line 333 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 311 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.