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

Public Member Functions

 Timestamp ()
 Timestamp (UInt32 year, Month month, UInt32 day)
 Timestamp (UInt32 year, Month month, UInt32 day, UInt32 hour, UInt32 minute, UInt32 second, UInt32 nanosecond)
 Timestamp (const Timestamp &other)
UInt32 year () const
Month month () const
UInt32 day () const
UInt32 hour () const
UInt32 minute () const
UInt32 second () const
UInt32 millisecond () const
UInt32 microsecond () const
UInt32 nanosecond () const
Timestamp date () const
TimeSpan time () const
DayOfWeek dayOfWeek () const
bool operator== (const Timestamp &other) const
bool operator!= (const Timestamp &other) const
bool operator< (const Timestamp &other) const
bool operator> (const Timestamp &other) const
Timestampoperator+= (const TimeSpan &span)
Timestampoperator-= (const TimeSpan &span)
Timestampoperator= (const Timestamp &other)
std::string toString (TimestampFormat format=TimestampFormats::YYYYMMDDHHMMSSnsec) const
void toString (std::string &str, TimestampFormat format=TimestampFormats::YYYYMMDDHHMMSSnsec) const
UInt64 toUnixTimestamp (SinceEpochUnit unit) const

Static Public Member Functions

static Timestamp now ()
static void now (Timestamp &)
static Timestamp utcNow ()
static void utcNow (Timestamp &)
static Timestamp deserialize (const StringRef &)
static Timestamp fromUnixTimestamp (UInt64 sinceEpoch, SinceEpochUnit unit)
static Timestamp maxTimestamp ()

Friends

TimeSpan operator- (const Timestamp &left, const Timestamp &right)

Detailed Description

Definition at line 437 of file Time.h.

Constructor & Destructor Documentation

◆ Timestamp() [1/4]

Timestamp ( )

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

◆ Timestamp() [2/4]

Timestamp ( UInt32 year,
Month month,
UInt32 day )

Initializes as date with zero time component.

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

◆ Timestamp() [3/4]

Timestamp ( UInt32 year,
Month month,
UInt32 day,
UInt32 hour,
UInt32 minute,
UInt32 second,
UInt32 nanosecond )

Explicit timestamp initialization.

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

◆ Timestamp() [4/4]

Timestamp ( const Timestamp & other)

Initializes as copy of other instance.

Member Function Documentation

◆ date()

Timestamp date ( ) const

Returns timestamp without time part.

◆ day()

UInt32 day ( ) const

Day component of timestamp.

◆ dayOfWeek()

DayOfWeek dayOfWeek ( ) const

Returns day of the week.

◆ deserialize()

Timestamp deserialize ( const StringRef & )
static

De-serializes timestamp from text presentation.

◆ fromUnixTimestamp()

Timestamp fromUnixTimestamp ( UInt64 sinceEpoch,
SinceEpochUnit unit )
static

Converts timestamp from its numeric presentation (Unix timestamp in nanoseconds or days since 01-01-1970 UTC) as it's used by the CME Globex.

◆ hour()

UInt32 hour ( ) const

Hour component of timestamp.

◆ maxTimestamp()

Timestamp maxTimestamp ( )
static

Returns the maximal possible timestamp (year 2554)

◆ microsecond()

UInt32 microsecond ( ) const

Microsecond component of timestamp.

◆ millisecond()

UInt32 millisecond ( ) const

Millisecond component of timestamp.

◆ minute()

UInt32 minute ( ) const

Minute component of timestamp.

◆ month()

Month month ( ) const

Month component of timestamp.

◆ nanosecond()

UInt32 nanosecond ( ) const

Nanosecond component of timestamp.

◆ now() [1/2]

Timestamp now ( )
static

Return timestamp that is current date and time expressed as local time.

◆ now() [2/2]

void now ( Timestamp & )
static

Return timestamp that is current date and time expressed as local time.

◆ operator!=()

bool operator!= ( const Timestamp & other) const

Compares with other instance for inequality.

◆ operator+=()

Timestamp & operator+= ( const TimeSpan & span)

Adds time interval to given timestamp.

◆ operator-=()

Timestamp & operator-= ( const TimeSpan & span)

Subtracts time interval from given timestamp.

◆ operator<()

bool operator< ( const Timestamp & other) const

Checks whether timestamp is less than other one.

◆ operator=()

Timestamp & operator= ( const Timestamp & other)

Re-initializes as copy of other timestamp.

◆ operator==()

bool operator== ( const Timestamp & other) const

Compares with other instance for equality.

◆ operator>()

bool operator> ( const Timestamp & other) const

Checks whether timestamp is greater than other one.

◆ second()

UInt32 second ( ) const

Second component of timestamp.

◆ time()

TimeSpan time ( ) const

Return time part of timestamp.

◆ toString() [1/2]

void toString ( std::string & str,
TimestampFormat format = TimestampFormats::YYYYMMDDHHMMSSnsec ) const

Returns text presentation of timestamp using specified presentation format.

◆ toString() [2/2]

std::string toString ( TimestampFormat format = TimestampFormats::YYYYMMDDHHMMSSnsec) const
inline

Returns text presentation of timestamp using specified presentation format.

Definition at line 579 of file Time.h.

◆ toUnixTimestamp()

UInt64 toUnixTimestamp ( SinceEpochUnit unit) const

Converts timestamp into its numeric presentation (Unix timestamp in nanoseconds or days since 01-01-1970 UTC) as it's used by the CME Globex.

◆ utcNow() [1/2]

Timestamp utcNow ( )
static

Return timestamp that is current date and time expressed as UTC time.

◆ utcNow() [2/2]

void utcNow ( Timestamp & )
static

Return timestamp that is current date and time expressed as UTC time.

◆ year()

UInt32 year ( ) const

Year component of timestamp.

◆ operator-

TimeSpan operator- ( const Timestamp & left,
const Timestamp & right )
friend

Calculates time interval between two timestamps.