OnixS C++ CME MDP Premium Market Data Handler 5.11.1
Users' manual and API documentation
Loading...
Searching...
No Matches
Timestamp Class Reference

#include <OnixS/CME/MDH/messaging/Time.h>

Public Types

enum  
typedef UInt64 Ticks
typedef UInt32 Year
using Month = OnixS::CME::MDH::Messaging::Month::Enum
typedef UInt32 Day
typedef UInt32 Hour
typedef UInt32 Minute
typedef UInt32 Second
typedef UInt32 Millisecond
typedef UInt32 Microsecond
typedef UInt32 Nanosecond

Public Member Functions

std::string toString (TimestampFormat::Enum=TimestampFormat::YYYYMMDDHHMMSSnsec) const
 Timestamp (Ticks ticks=0) noexcept
 Timestamp (Year year, Month month, Day day, Hour hour=0, Minute minute=0, Second second=0, Nanosecond nanosecond=0)
 Timestamp (const Timestamp &other) noexcept
Year year () const
Month month () const
Day day () const
Hour hour () const noexcept
Minute minute () const noexcept
Second second () const noexcept
Millisecond millisecond () const noexcept
Microsecond microsecond () const noexcept
Nanosecond nanosecond () const noexcept
Timestamp date () const noexcept
TimeSpan time () const noexcept
Ticks sinceEpoch () const noexcept
Timestamp & operator= (const Timestamp &other) noexcept
void swap (Timestamp &other) noexcept

Static Public Member Functions

static Timestamp fromStr (const std::string &, TimestampFormat::Enum=TimestampFormat::YYYYMMDDHHMMSSnsec)
static Timestamp now () noexcept
static Timestamp utcNow () noexcept

Detailed Description

Definition at line 449 of file Time.h.

Member Typedef Documentation

◆ Day

typedef UInt32 Day

Integral type presenting the day component.

Definition at line 462 of file Time.h.

◆ Hour

typedef UInt32 Hour

Integral type presenting the hour component.

Definition at line 465 of file Time.h.

◆ Microsecond

Integral type presenting the microsecond component.

Definition at line 477 of file Time.h.

◆ Millisecond

Integral type presenting the millisecond component.

Definition at line 474 of file Time.h.

◆ Minute

typedef UInt32 Minute

Integral type presenting the minute component.

Definition at line 468 of file Time.h.

◆ Month

Type presenting the month component.

Definition at line 459 of file Time.h.

◆ Nanosecond

typedef UInt32 Nanosecond

Integral type presenting the nanosecond component.

Definition at line 480 of file Time.h.

◆ Second

typedef UInt32 Second

Integral type presenting the second component.

Definition at line 471 of file Time.h.

◆ Ticks

typedef UInt64 Ticks

Integral type storing internal ticks.

Definition at line 453 of file Time.h.

◆ Year

typedef UInt32 Year

Integral type presenting the year component.

Definition at line 456 of file Time.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Size 8 

Definition at line 640 of file Time.h.

Constructor & Destructor Documentation

◆ Timestamp() [1/3]

Timestamp ( Ticks ticks = 0)
inlineexplicitnoexcept

Initializes from the number of ticks since epoch.

Definition at line 487 of file Time.h.

◆ Timestamp() [2/3]

Timestamp ( Year year,
Month month,
Day day,
Hour hour = 0,
Minute minute = 0,
Second second = 0,
Nanosecond nanosecond = 0 )
inline

Explicit time-stamp initialization.

Input parameters are validated, therefore constructor throws an exception if input values do not fit into their valid ranges.

Definition at line 496 of file Time.h.

◆ Timestamp() [3/3]

Timestamp ( const Timestamp & other)
inlinenoexcept

Definition at line 509 of file Time.h.

Member Function Documentation

◆ date()

Timestamp date ( ) const
inlinenoexcept
Returns
the Timestamp without a time part.

Definition at line 587 of file Time.h.

◆ day()

Day day ( ) const
inline
Returns
Day component

Definition at line 539 of file Time.h.

◆ fromStr()

Timestamp fromStr ( const std::string & str,
TimestampFormat::Enum format = TimestampFormat::YYYYMMDDHHMMSSnsec )
inlinestatic

De-serializes a timestamp from the given string.

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

Definition at line 794 of file Time.h.

◆ hour()

Hour hour ( ) const
inlinenoexcept
Returns
the Hour component

Definition at line 551 of file Time.h.

◆ microsecond()

Microsecond microsecond ( ) const
inlinenoexcept
Returns
the Microsecond component.

Definition at line 575 of file Time.h.

◆ millisecond()

Millisecond millisecond ( ) const
inlinenoexcept
Returns
the Millisecond component.

Definition at line 569 of file Time.h.

◆ minute()

Minute minute ( ) const
inlinenoexcept
Returns
the Minute component.

Definition at line 557 of file Time.h.

◆ month()

Month month ( ) const
inline
Returns
the Month component.

Definition at line 527 of file Time.h.

◆ nanosecond()

Nanosecond nanosecond ( ) const
inlinenoexcept
Returns
the Nanosecond component.

Definition at line 581 of file Time.h.

◆ now()

Timestamp now ( )
staticnoexcept

Current local time.

◆ operator=()

Timestamp & operator= ( const Timestamp & other)
inlinenoexcept

Definition at line 604 of file Time.h.

◆ second()

Second second ( ) const
inlinenoexcept
Returns
the Second component.

Definition at line 563 of file Time.h.

◆ sinceEpoch()

Ticks sinceEpoch ( ) const
inlinenoexcept
Returns
the number of nanoseconds since the Epoch (01-01-1970).

Definition at line 599 of file Time.h.

◆ swap()

void swap ( Timestamp & other)
inlinenoexcept

Exchanges the value.

Definition at line 612 of file Time.h.

◆ time()

TimeSpan time ( ) const
inlinenoexcept
Returns
the Time part of timestamp.

Definition at line 593 of file Time.h.

◆ toString()

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

Definition at line 823 of file Time.h.

◆ utcNow()

Timestamp utcNow ( )
staticnoexcept

Current utc time.

◆ year()

Year year ( ) const
inline
Returns
the Year component.

Definition at line 515 of file Time.h.