EPAM B2BITS C++ Bovespa MarketData handler  1.28.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
B2bits::UTCTimestamp Class Reference

Encapsulates UTCTimestamp FIX type. More...

#include <b2bits/types/UTCTimestamp.h>

Public Types

typedef u64 value_type
 A type that represents internal representation of the date. More...
 

Public Member Functions

 UTCTimestamp () throw ()
 Default constructor. More...
 
 UTCTimestamp (int year, int month, int day, int hour, int minute, int second, int millisecond=0) throw ()
 Constructor. Constructs object from year, month, day, hour, minute, second and millisecond values. More...
 
bool operator== (const UTCTimestamp &v) const throw ()
 Compare operators. More...
 
bool operator!= (const UTCTimestamp &v) const throw ()
 Compare operators. More...
 
bool operator< (const UTCTimestamp &v) const throw ()
 Compare operators. More...
 
bool operator> (const UTCTimestamp &v) const throw ()
 Compare operators. More...
 
bool operator>= (const UTCTimestamp &v) const throw ()
 Compare operators. More...
 
bool operator<= (const UTCTimestamp &v) const throw ()
 Compare operators. More...
 
int year () const throw ()
 Returns year part of value. More...
 
int month () const throw ()
 Returns month part of value. More...
 
int day () const throw ()
 Returns day part of value. More...
 
int hour () const throw ()
 Returns day hour of value. More...
 
int minute () const throw ()
 Returns day minute of value. More...
 
int second () const throw ()
 Returns day second of value. More...
 
int millisecond () const throw ()
 Returns day millisecond of value. More...
 
int dayOfWeek () const throw ()
 
std::string & toFixString (std::string *dest, bool keepmsec=false) const
 Converts value stored in object to FIX string 'YYYYMMDD-HH:MM:SS.zzz'. More...
 
char * toFixString (char *buf, char *end, bool keepmsec=false) const throw ()
 
u64 toDecimal () const throw ()
 Returns value in decimal format (YYYYMMDDHHMMSSzzz) More...
 
UTCTimestamp getWithoutMilliseconds () const throw ()
 Erases milliseconds. More...
 
u64 toUnixTimeInMillis () const throw ()
 Converts UTCTimestamp to number of milliseconds since Unix epoch. More...
 

Static Public Member Functions

static UTCTimestamp fromFixString (AsciiString val) throw ()
 Constructs object from FIX string (YYYYMMDD-HH:MM:SS.zzz). More...
 
static UTCTimestamp fromDecimal (u64 val) throw ()
 Constructs object from decimal date format (YYYYMMDDHHMMSSzzz). More...
 
static UTCTimestamp fromDecimalString (AsciiString val) throw ()
 Constructs object from decimal date format (YYYYMMDDHHMMSSzzz). More...
 
static UTCTimestamp fromString (AsciiString val) throw ()
 Constructs object from decimal date format (YYYYMMDDHHMMSSzzz) or FIX string (YYYYMMDD-HH:MM:SS.zzz). More...
 
static UTCTimestamp fromUnixTimeInMillis (u64 val) throw ()
 
static UTCTimestamp fromTimeT (time_t t, int millis=0) throw ()
 
static UTCTimestamp now (bool withMilliseconds=false) throw ()
 

Static Public Attributes

static const unsigned int ValueSizeWithMilliseconds = sizeof( "YYYYMMDD-HH:MM:SS.sss" ) - 1
 Maximum buffer size required to store value. More...
 
static const unsigned int ValueSizeNoMilliseconds = sizeof( "YYYYMMDD-HH:MM:SS" ) - 1
 Maximum buffer size required to store value. More...
 
static const unsigned int DecimalValueSizeWithMilliseconds = sizeof( "YYYYMMDDHHMMSSsss" ) - 1
 Maximum buffer size required to store value. More...
 
static const unsigned int DecimalValueSizeNoMilliseconds = sizeof( "YYYYMMDDHHMMSS" ) - 1
 Maximum buffer size required to store value. More...
 
static const unsigned int ValueSize = ValueSizeWithMilliseconds
 Maximum buffer size required to store value. More...
 

Detailed Description

Encapsulates UTCTimestamp FIX type.

Member Typedef Documentation

A type that represents internal representation of the date.

Constructor & Destructor Documentation

B2bits::UTCTimestamp::UTCTimestamp ( )
throw (
)

Default constructor.

B2bits::UTCTimestamp::UTCTimestamp ( int  year,
int  month,
int  day,
int  hour,
int  minute,
int  second,
int  millisecond = 0 
)
throw (
)

Constructor. Constructs object from year, month, day, hour, minute, second and millisecond values.

Member Function Documentation

int B2bits::UTCTimestamp::day ( ) const
throw (
)

Returns day part of value.

int B2bits::UTCTimestamp::dayOfWeek ( ) const
throw (
)

Returns day of the week. 0 means Sunday, 1 - Monday, 2 - Tuesday, ... 5 - Friday

static UTCTimestamp B2bits::UTCTimestamp::fromDecimal ( u64  val)
throw (
)
static

Constructs object from decimal date format (YYYYMMDDHHMMSSzzz).

static UTCTimestamp B2bits::UTCTimestamp::fromDecimalString ( AsciiString  val)
throw (
)
static

Constructs object from decimal date format (YYYYMMDDHHMMSSzzz).

static UTCTimestamp B2bits::UTCTimestamp::fromFixString ( AsciiString  val)
throw (
)
static

Constructs object from FIX string (YYYYMMDD-HH:MM:SS.zzz).

static UTCTimestamp B2bits::UTCTimestamp::fromString ( AsciiString  val)
throw (
)
static

Constructs object from decimal date format (YYYYMMDDHHMMSSzzz) or FIX string (YYYYMMDD-HH:MM:SS.zzz).

static UTCTimestamp B2bits::UTCTimestamp::fromTimeT ( time_t  t,
int  millis = 0 
)
throw (
)
static

Constructs object using time_t value. In case of error (if passed value is too large) function returns zero UTCTimestamp (00000000-00:00:00.000)

static UTCTimestamp B2bits::UTCTimestamp::fromUnixTimeInMillis ( u64  val)
throw (
)
static

Constructs object using the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC. In case of error (if passed value is too large) function returns zero UTCTimestamp (00000000-00:00:00.000)

UTCTimestamp B2bits::UTCTimestamp::getWithoutMilliseconds ( ) const
throw (
)
inline

Erases milliseconds.

int B2bits::UTCTimestamp::hour ( ) const
throw (
)

Returns day hour of value.

int B2bits::UTCTimestamp::millisecond ( ) const
throw (
)

Returns day millisecond of value.

int B2bits::UTCTimestamp::minute ( ) const
throw (
)

Returns day minute of value.

int B2bits::UTCTimestamp::month ( ) const
throw (
)

Returns month part of value.

static UTCTimestamp B2bits::UTCTimestamp::now ( bool  withMilliseconds = false)
throw (
)
static

Returns UTCTimestamp with current time

Parameters
withMillisecondsPass true to obtain time with milliseconds; false otherwise.
Returns
Instance of the UTCTimestamp which contains current time.
bool B2bits::UTCTimestamp::operator!= ( const UTCTimestamp v) const
throw (
)
inline

Compare operators.

bool B2bits::UTCTimestamp::operator< ( const UTCTimestamp v) const
throw (
)
inline

Compare operators.

bool B2bits::UTCTimestamp::operator<= ( const UTCTimestamp v) const
throw (
)
inline

Compare operators.

bool B2bits::UTCTimestamp::operator== ( const UTCTimestamp v) const
throw (
)
inline

Compare operators.

bool B2bits::UTCTimestamp::operator> ( const UTCTimestamp v) const
throw (
)
inline

Compare operators.

bool B2bits::UTCTimestamp::operator>= ( const UTCTimestamp v) const
throw (
)
inline

Compare operators.

int B2bits::UTCTimestamp::second ( ) const
throw (
)

Returns day second of value.

u64 B2bits::UTCTimestamp::toDecimal ( ) const
throw (
)

Returns value in decimal format (YYYYMMDDHHMMSSzzz)

std::string& B2bits::UTCTimestamp::toFixString ( std::string *  dest,
bool  keepmsec = false 
) const

Converts value stored in object to FIX string 'YYYYMMDD-HH:MM:SS.zzz'.

char* B2bits::UTCTimestamp::toFixString ( char *  buf,
char *  end,
bool  keepmsec = false 
) const
throw (
)

Converts stored value to FIX string 'YYYYMMDD-HH:MM:SS.zzz'.

Parameters
bufMemory buffer enough to store string like YYYYMMDD-HH:MM:SS.zzz
endPointer to past-the-end element of memory buffer
keepmsecPass true to convert time with milliseconds
Returns
pointer to the first character of the result. Last character of result is last character of the 'buf' parameter.
u64 B2bits::UTCTimestamp::toUnixTimeInMillis ( ) const
throw (
)

Converts UTCTimestamp to number of milliseconds since Unix epoch.

int B2bits::UTCTimestamp::year ( ) const
throw (
)

Returns year part of value.

Member Data Documentation

const unsigned int B2bits::UTCTimestamp::DecimalValueSizeNoMilliseconds = sizeof( "YYYYMMDDHHMMSS" ) - 1
static

Maximum buffer size required to store value.

const unsigned int B2bits::UTCTimestamp::DecimalValueSizeWithMilliseconds = sizeof( "YYYYMMDDHHMMSSsss" ) - 1
static

Maximum buffer size required to store value.

const unsigned int B2bits::UTCTimestamp::ValueSize = ValueSizeWithMilliseconds
static

Maximum buffer size required to store value.

const unsigned int B2bits::UTCTimestamp::ValueSizeNoMilliseconds = sizeof( "YYYYMMDD-HH:MM:SS" ) - 1
static

Maximum buffer size required to store value.

const unsigned int B2bits::UTCTimestamp::ValueSizeWithMilliseconds = sizeof( "YYYYMMDD-HH:MM:SS.sss" ) - 1
static

Maximum buffer size required to store value.