OnixS C++ eSpeed ITCH Market Data Handler 1.7.3
API documentation
Loading...
Searching...
No Matches
Timestamp Class Reference

Public Member Functions

 Timestamp ()
 Timestamp (unsigned int year, Month::Enum month, unsigned int day, unsigned int hour=0, unsigned int minute=0, unsigned int second=0, unsigned int nanosecond=0)
 Timestamp (RawTimestamp ts)
unsigned year () const
Month::Enum month () const
unsigned int day () const
void date (YearMonthDay &) const
unsigned int hour () const
unsigned int minute () const
unsigned int second () const
unsigned int millisecond () const
unsigned int microsecond () const
unsigned int nanosecond () const
const TimeSpansinceEpoch () const
bool operator== (const Timestamp &) const
bool operator!= (const Timestamp &) const
bool operator< (const Timestamp &) const
std::string toString (TimestampFormat::Enum=TimestampFormat::YYYYMMDDHHMMSSNsec) const
void toString (std::string &str, TimestampFormat::Enum=TimestampFormat::YYYYMMDDHHMMSSNsec) const

Static Public Member Functions

static Timestamp epoch ()
static Timestamp utcNow ()
static Timestamp now ()
static Timestamp parse (const std::string &, TimestampFormat::Enum=TimestampFormat::YYYYMMDDHHMMSSNsec)
static Timestamp parse (unsigned long long presentation, TimestampFormat::Enum format)

Friends

struct HandlerCore::Common::TimeHelper

Detailed Description

Definition at line 89 of file Timestamp.h.

Constructor & Destructor Documentation

◆ Timestamp() [1/3]

Timestamp ( )

Initializes as Jan 1, 0001, 00:00:00.

◆ Timestamp() [2/3]

Timestamp ( unsigned int year,
Month::Enum month,
unsigned int day,
unsigned int hour = 0,
unsigned int minute = 0,
unsigned int second = 0,
unsigned int nanosecond = 0 )

Initializes date-time from all details.

◆ Timestamp() [3/3]

Timestamp ( RawTimestamp ts)
explicit

Initializes date-time from raw presentation provided by the exchange 4 most significant bytes – seconds since Epoch 4 least significant bytes – nanoseconds within second

Member Function Documentation

◆ date()

void date ( YearMonthDay & ) const

Returns date part of timestamp.

◆ day()

unsigned int day ( ) const

day of month component of timestamp Valid values are 1 through 31.

◆ epoch()

Timestamp epoch ( )
static

Epoch.

◆ hour()

unsigned int hour ( ) const

Hour component of timestamp. Valid values are 0 through 23.

◆ microsecond()

unsigned int microsecond ( ) const
inline

Microsecond component of timestamp Valid values are 0 through 999999.

Definition at line 226 of file Timestamp.h.

◆ millisecond()

unsigned int millisecond ( ) const
inline

Millisecond component of timestamp Valid values are 0 through 999.

Definition at line 219 of file Timestamp.h.

◆ minute()

unsigned int minute ( ) const

Minute component of timestamp Valid values are 0 through 59.

◆ month()

Month::Enum month ( ) const

Month component of timestamp.

◆ nanosecond()

unsigned int nanosecond ( ) const
inline

Nanosecond component of timestamp Valid values are 0 through 999999999.

Definition at line 233 of file Timestamp.h.

◆ now()

Timestamp now ( )
static

Returns the current local time.

Note
Timestamp resolution depends on capabilities of an operating system.

◆ operator!=()

bool operator!= ( const Timestamp & ) const

Compares instance with another one.

◆ operator<()

bool operator< ( const Timestamp & ) const

Tests whether instance is less than another one.

◆ operator==()

bool operator== ( const Timestamp & ) const

Compares instance with another one.

◆ parse() [1/2]

Timestamp parse ( const std::string & ,
TimestampFormat::Enum = TimestampFormat::YYYYMMDDHHMMSSNsec )
static

Parses timestamp from its text presentation assuming it's in specified format ("YYYYMMDD-HH:MM:SS.sssssssss" by default).

◆ parse() [2/2]

Timestamp parse ( unsigned long long presentation,
TimestampFormat::Enum format )
static

Parses timestamp from its numeric presentation.

◆ second()

unsigned int second ( ) const

Second component of timestamp Valid values are 0 through 59.

◆ sinceEpoch()

const TimeSpan & sinceEpoch ( ) const
inline

Time span since Jan 1, 0001, 00:00:00.

Definition at line 240 of file Timestamp.h.

◆ toString() [1/2]

void toString ( std::string & str,
TimestampFormat::Enum = TimestampFormat::YYYYMMDDHHMMSSNsec ) const

Appends timestamp text presentation in requested format ("YYYYMMDD-HH:MM:SS.sssssssss" by default).

◆ toString() [2/2]

std::string toString ( TimestampFormat::Enum format = TimestampFormat::YYYYMMDDHHMMSSNsec) const
inline

Returns timestamp text presentation in requested format ("YYYYMMDD-HH:MM:SS.sssssssss" by default).

Definition at line 247 of file Timestamp.h.

◆ utcNow()

Timestamp utcNow ( )
static

Returns the current UTC time.

Note
Timestamp resolution depends on capabilities of an operating system.

◆ year()

unsigned year ( ) const

Year component of timestamp.

◆ HandlerCore::Common::TimeHelper

friend struct HandlerCore::Common::TimeHelper
friend

Definition at line 205 of file Timestamp.h.