OnixS Xetra MDI Market Data Handler for C++  1.0.0.0
Public Member Functions | Static Public Member Functions | Friends | List of all members
Timestamp Class Reference

Represents timestamp without time-zone information. More...

Public Member Functions

 Timestamp ()
 Initializes as Jan 1, 0001, 00:00:00.
 
 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.
 
unsigned year () const
 Year component of timestamp.
 
Month::Enum month () const
 Month component of timestamp.
 
unsigned int day () const
 day of month component of timestamp Valid values are 1 through 31. More...
 
void date (YearMonthDay &) const
 Returns date part of timestamp.
 
unsigned int hour () const
 Hour component of timestamp. More...
 
unsigned int minute () const
 Minute component of timestamp Valid values are 0 through 59. More...
 
unsigned int second () const
 Second component of timestamp Valid values are 0 through 59. More...
 
unsigned int millisecond () const
 Millisecond component of timestamp Valid values are 0 through 999. More...
 
unsigned int microsecond () const
 Microsecond component of timestamp Valid values are 0 through 999999. More...
 
unsigned int nanosecond () const
 Nanosecond component of timestamp Valid values are 0 through 999999999. More...
 
const TimeSpansinceEpoch () const
 Time span since Jan 1, 0001, 00:00:00.
 
bool operator== (const Timestamp &) const
 Compares instance with another one.
 
bool operator!= (const Timestamp &) const
 Compares instance with another one.
 
bool operator< (const Timestamp &) const
 Tests whether instance is less than another one.
 
std::string toString (TimestampFormat::Enum=TimestampFormat::YYYYMMDDHHMMSSNsec) const
 Returns timestamp text presentation in requested format ("YYYYMMDD-HH:MM:SS.sssssssss" by default). More...
 
void toString (std::string &str, TimestampFormat::Enum=TimestampFormat::YYYYMMDDHHMMSSNsec) const
 Appends timestamp text presentation in requested format ("YYYYMMDD-HH:MM:SS.sssssssss" by default). More...
 

Static Public Member Functions

static Timestamp epoch ()
 Epoch.
 
static Timestamp utcNow ()
 Returns the current UTC time. More...
 
static Timestamp now ()
 Returns the current local time. More...
 
static Timestamp parse (const std::string &, TimestampFormat::Enum=TimestampFormat::YYYYMMDDHHMMSSNsec)
 Parses timestamp from its text presentation assuming it's in specified format ("YYYYMMDD-HH:MM:SS.sssssssss" by default). More...
 
static Timestamp parse (const char *data, size_t size, TimestampFormat::Enum=TimestampFormat::YYYYMMDDHHMMSSNsec)
 
static Timestamp parse (unsigned long long presentation, TimestampFormat::Enum format)
 Parses timestamp from its numeric presentation.
 

Friends

class TimeManager
 

Detailed Description

Represents timestamp without time-zone information.

Member Function Documentation

unsigned int day ( ) const

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

unsigned int hour ( ) const

Hour component of timestamp.

Valid values are 0 through 23.

unsigned int microsecond ( ) const
inline

Microsecond component of timestamp Valid values are 0 through 999999.

unsigned int millisecond ( ) const
inline

Millisecond component of timestamp Valid values are 0 through 999.

unsigned int minute ( ) const

Minute component of timestamp Valid values are 0 through 59.

unsigned int nanosecond ( ) const
inline

Nanosecond component of timestamp Valid values are 0 through 999999999.

static Timestamp now ( )
static

Returns the current local time.

Note
Timestamp resolution depends on capabilities of an operating system.
static 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).

unsigned int second ( ) const

Second component of timestamp Valid values are 0 through 59.

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

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

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

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

static Timestamp utcNow ( )
static

Returns the current UTC time.

Note
Timestamp resolution depends on capabilities of an operating system.