OnixS BME SENAF Handler C++ library  2.2.1
API documentation
Timestamp Class Reference

#include <OnixS/Senaf/MarketData/Time.h>

Public Member Functions

 Timestamp ()
 
 Timestamp (unsigned year, Month month, unsigned day)
 
 Timestamp (unsigned year, Month month, unsigned day, unsigned hour, unsigned minute, unsigned second, unsigned nanosecond)
 
 Timestamp (const Timestamp &other)
 
 Timestamp (const TimeSpan &)
 
unsigned int year () const
 
Month month () const
 
unsigned int day () 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
 
Timestamp date () const
 
void date (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
 

Static Public Member Functions

static Timestamp now ()
 
static Timestamp utcNow ()
 
static Timestamp deserialize (const std::string &)
 
static Timestamp deserialize (unsigned long long presentation, TimestampFormat format)
 

Friends

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

Detailed Description

Definition at line 407 of file Time.h.

Constructor & Destructor Documentation

Timestamp ( )

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

Timestamp ( unsigned  year,
Month  month,
unsigned  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 ( unsigned  year,
Month  month,
unsigned  day,
unsigned  hour,
unsigned  minute,
unsigned  second,
unsigned  nanosecond 
)

Explicit timestamp initialization.

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

Timestamp ( const Timestamp other)

Initializes as copy of other instance.

Timestamp ( const TimeSpan )

Initializes from time interval since the Epoch.

Member Function Documentation

Timestamp date ( ) const

Returns timestamp without time part.

void date ( Date ) const

Returns date component of timestamp.

unsigned int day ( ) const

Day component of timestamp.

DayOfWeek dayOfWeek ( ) const

Returns day of the week.

static Timestamp deserialize ( const std::string &  )
static

De-serializes timestamp from text presentation.

static Timestamp deserialize ( unsigned long long  presentation,
TimestampFormat  format 
)
static

De-serializes timestamp from its numeric presentation as it's used by the Senaf.

unsigned int hour ( ) const
inline

Hour component of timestamp.

Definition at line 533 of file Time.h.

unsigned int microsecond ( ) const
inline

Microsecond component of timestamp.

Definition at line 553 of file Time.h.

unsigned int millisecond ( ) const
inline

Millisecond component of timestamp.

Definition at line 548 of file Time.h.

unsigned int minute ( ) const
inline

Minute component of timestamp.

Definition at line 538 of file Time.h.

Month month ( ) const

Month component of timestamp.

unsigned int nanosecond ( ) const
inline

Nanosecond component of timestamp.

Definition at line 558 of file Time.h.

static Timestamp now ( )
static

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

bool operator!= ( const Timestamp other) const

Compares with other instance for inequality.

Timestamp& operator+= ( const TimeSpan span)

Adds time interval to given timestamp.

Timestamp& operator-= ( const TimeSpan span)

Subtracts time interval from given timestamp.

bool operator< ( const Timestamp other) const

Checks whether timestamp is less than other one.

Timestamp& operator= ( const Timestamp other)

Re-initializes as copy of other timestamp.

bool operator== ( const Timestamp other) const

Compares with other instance for equality.

bool operator> ( const Timestamp other) const

Checks whether timestamp is greater than other one.

unsigned int second ( ) const
inline

Second component of timestamp.

Definition at line 543 of file Time.h.

TimeSpan time ( ) const

Return time part of timestamp.

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

Returns text presentation of timestamp using specified presentation format.

Definition at line 563 of file Time.h.

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

Returns text presentation of timestamp using specified presentation format.

static Timestamp utcNow ( )
static

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

unsigned int year ( ) const

Year component of timestamp.

Friends And Related Function Documentation

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

Calculates time interval between two timestamps.


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