OnixS C++ FIX Engine 4.13.0
API Documentation
Loading...
Searching...
No Matches
Timestamp Class Reference

Public Member Functions

 Timestamp ()
 Timestamp (TotalSeconds seconds, Nanosecond nanosecond)
 Timestamp (TotalSeconds seconds, Picosecond picosecond)
 Timestamp (Year year, Month::Enum month, Day day, Hour hour=0, Minute minute=0, Second second=0, Nanosecond nanosecond=0)
 Timestamp (Year year, Month::Enum month, Day day, Hour hour, Minute minute, Second second, Picosecond picosecond)
 Timestamp (TotalNanoseconds unixTimestampNanoseconds)
Year year () const
Month::Enum month () const
Day day () const
void date (YearMonthDay &) const
Hour hour () const
Minute minute () const
Second second () const
Millisecond millisecond () const
Microsecond microsecond () const
Nanosecond nanosecond () const
Picosecond picosecond () const
TotalSeconds totalSeconds () const
bool operator== (const Timestamp &) const
bool operator!= (const Timestamp &) const
bool operator< (const Timestamp &) const
Timestampoperator+= (const TimeSpan &)
Timestampoperator-= (const TimeSpan &)
TimeSpan operator- (const Timestamp &)
std::string toString (TimestampFormat::Enum=TimestampFormat::YYYYMMDDHHMMSSNsec) const
void toString (std::string &str, TimestampFormat::Enum=TimestampFormat::YYYYMMDDHHMMSSNsec) const
TotalNanoseconds toUnixNanosecondTimestamp () const

Static Public Member Functions

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

Friends

class TimeManager

Detailed Description

Definition at line 91 of file Timestamp.h.

Constructor & Destructor Documentation

◆ Timestamp() [1/6]

Timestamp ( )

Constructs an uninitialized instance.

◆ Timestamp() [2/6]

Timestamp ( TotalSeconds seconds,
Nanosecond nanosecond )
inline

Initializes from seconds and nanoseconds since Jan 1, 0001, 00:00:00.

Definition at line 231 of file Timestamp.h.

◆ Timestamp() [3/6]

Timestamp ( TotalSeconds seconds,
Picosecond picosecond )
inline

Initializes from seconds and picoseconds since Jan 1, 0001, 00:00:00.

Definition at line 239 of file Timestamp.h.

◆ Timestamp() [4/6]

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

Initializes date-time from all details.

◆ Timestamp() [5/6]

Timestamp ( Year year,
Month::Enum month,
Day day,
Hour hour,
Minute minute,
Second second,
Picosecond picosecond )

Initializes date-time from all details.

◆ Timestamp() [6/6]

Timestamp ( TotalNanoseconds unixTimestampNanoseconds)
explicit

Initializes from nanoseconds since Jan 1, 1970, 00:00:00 (Unix epoch).

Member Function Documentation

◆ date()

void date ( YearMonthDay & ) const

Returns the date part of the timestamp.

◆ day()

Day day ( ) const

The current day of month.

Valid values are 1 through 31.

◆ hour()

Hour hour ( ) const

The current hour.

Valid values are 0 through 23.

◆ local()

Timestamp local ( )
static

Returns the current local time.

Note
The timestamp resolution depends on capabilities of an operating system.

◆ microsecond()

Microsecond microsecond ( ) const
inline

The current microsecond.

Valid values are 0 through 999999.

Definition at line 262 of file Timestamp.h.

◆ millisecond()

Millisecond millisecond ( ) const
inline

The current millisecond.

Valid values are 0 through 999.

Definition at line 255 of file Timestamp.h.

◆ minute()

Minute minute ( ) const

The current minute.

Valid values are 0 through 59.

◆ month()

Month::Enum month ( ) const

The current month.

◆ nanosecond()

Nanosecond nanosecond ( ) const
inline

The current nanosecond.

Valid values are 0 through 999999999.

Definition at line 269 of file Timestamp.h.

◆ operator!=()

bool operator!= ( const Timestamp & ) const

Compares the instance with another one.

◆ operator+=()

Timestamp & operator+= ( const TimeSpan & )

Increases the instance by time span.

◆ operator-()

TimeSpan operator- ( const Timestamp & )

Calculates the time interval between two time points.

◆ operator-=()

Timestamp & operator-= ( const TimeSpan & )

Decreases the instance by time span.

◆ operator<()

bool operator< ( const Timestamp & ) const

Tests whether the instance is less than another one.

◆ operator==()

bool operator== ( const Timestamp & ) const

Compares the instance with another one.

◆ parse()

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

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

◆ picosecond()

Picosecond picosecond ( ) const
inline

The current picosecond.

Valid values are 0 through 999999999999.

Definition at line 276 of file Timestamp.h.

◆ second()

Second second ( ) const

The current second.

Valid values are 0 through 59.

◆ toString() [1/2]

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

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

◆ toString() [2/2]

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

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

Definition at line 283 of file Timestamp.h.

◆ totalSeconds()

TotalSeconds totalSeconds ( ) const
inline

The total number of seconds since Jan 1, 0001, 00:00:00.

Definition at line 248 of file Timestamp.h.

◆ toUnixNanosecondTimestamp()

TotalNanoseconds toUnixNanosecondTimestamp ( ) const

Returns the nanosecond timestamp since the Unix epoch.

◆ utc()

Timestamp utc ( )
static

Returns the current UTC time.

Note
The timestamp resolution depends on capabilities of an operating system.

◆ year()

Year year ( ) const

The current year.

◆ TimeManager

friend class TimeManager
friend

Definition at line 224 of file Timestamp.h.