OnixS C++ FIX Engine  4.12.0
API Documentation
Timestamp Class Reference

#include <OnixS/FIXEngine/FIX/Timestamp.h>

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 &)
 
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 ( )

Constructs an uninitialized instance.

Timestamp ( TotalSeconds  seconds,
Nanosecond  nanosecond 
)
inline

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

Definition at line 228 of file Timestamp.h.

Timestamp ( TotalSeconds  seconds,
Picosecond  picosecond 
)
inline

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

Definition at line 236 of file Timestamp.h.

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 ( Year  year,
Month::Enum  month,
Day  day,
Hour  hour,
Minute  minute,
Second  second,
Picosecond  picosecond 
)

Initializes date-time from all details.

Timestamp ( TotalNanoseconds  unixTimestampNanoseconds)
explicit

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

Member Function Documentation

void date ( YearMonthDay ) const

Returns the date part of the timestamp.

Day day ( ) const

The current day of month.

Valid values are 1 through 31.

Hour hour ( ) const

The current hour.

Valid values are 0 through 23.

static Timestamp local ( )
static

Returns the current local time.

Note
The timestamp resolution depends on capabilities of an operating system.
Microsecond microsecond ( ) const
inline

The current microsecond.

Valid values are 0 through 999999.

Definition at line 259 of file Timestamp.h.

Millisecond millisecond ( ) const
inline

The current millisecond.

Valid values are 0 through 999.

Definition at line 252 of file Timestamp.h.

Minute minute ( ) const

The current minute.

Valid values are 0 through 59.

Month::Enum month ( ) const

The current month.

Nanosecond nanosecond ( ) const
inline

The current nanosecond.

Valid values are 0 through 999999999.

Definition at line 266 of file Timestamp.h.

bool operator!= ( const Timestamp ) const

Compares the instance with another one.

Timestamp& operator+= ( const TimeSpan )

Increases the instance by time span.

Timestamp& operator-= ( const TimeSpan )

Decreases the instance by time span.

bool operator< ( const Timestamp ) const

Tests whether the instance is less than another one.

bool operator== ( const Timestamp ) const

Compares the instance with another one.

static 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 ( ) const
inline

The current picosecond.

Valid values are 0 through 999999999999.

Definition at line 273 of file Timestamp.h.

Second second ( ) const

The current second.

Valid values are 0 through 59.

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 280 of file Timestamp.h.

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).

TotalSeconds totalSeconds ( ) const
inline

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

Definition at line 245 of file Timestamp.h.

TotalNanoseconds toUnixNanosecondTimestamp ( ) const

Returns the nanosecond timestamp since the Unix epoch.

static Timestamp utc ( )
static

Returns the current UTC time.

Note
The timestamp resolution depends on capabilities of an operating system.
Year year ( ) const

The current year.

Friends And Related Function Documentation

friend class TimeManager
friend

Definition at line 221 of file Timestamp.h.


The documentation for this class was generated from the following file: