B2BITS FIX Antenna C++  2.27.0
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Engine::UTCTimestamp Class Reference

Encapsulates UTCTimestamp FIX type. More...

#include <B2BITS_UTCTimestamp.h>

Public Types

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

Public Member Functions

int day () const throw ()
 Returns day part of value. More...
 
int dayOfWeek () const throw ()
 Returns day of the week. More...
 
UTCTimestamp getWithoutMilliseconds () const throw ()
 Erases milliseconds. More...
 
int hour () const throw ()
 Returns day hour of value. More...
 
int millisecond () const throw ()
 Returns day millisecond of value. More...
 
int minute () const throw ()
 Returns day minute of value. More...
 
int month () const throw ()
 Returns month part of value. 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 second () const throw ()
 Returns day second of value. More...
 
System::u64 toDecimal () const throw ()
 Returns value in decimal format (YYYYMMDDHHMMSSzzz) More...
 
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 ()
 Converts stored value to FIX string 'YYYYMMDD-HH:MM:SS.zzz'. More...
 
 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...
 
int year () const throw ()
 Returns year part of value. More...
 

Static Public Member Functions

static UTCTimestamp fromDecimal (System::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 fromFixString (AsciiString val) throw ()
 Constructs object from FIX string (YYYYMMDD-HH:MM:SS.zzz). 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 fromTimeT (time_t t, int millis=0) throw ()
 Constructs object using time_t value. More...
 
static UTCTimestamp fromUnixTimeInMillis (System::u64 val) throw ()
 Constructs object using the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC. More...
 
static UTCTimestamp now (bool withMilliseconds=false) throw ()
 Returns UTCTimestamp with current time. More...
 

Static Public Attributes

static const unsigned int DecimalValueSizeNoMilliseconds = sizeof( "YYYYMMDDHHMMSS" ) - 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 ValueSize = ValueSizeWithMilliseconds
 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 ValueSizeWithMilliseconds = sizeof( "YYYYMMDD-HH:MM:SS.sss" ) - 1
 Maximum buffer size required to store value. More...
 

Detailed Description

Encapsulates UTCTimestamp FIX type.

Member Typedef Documentation

◆ value_type

typedef System::u64 Engine::UTCTimestamp::value_type

A type that represents internal representation of the date.

Constructor & Destructor Documentation

◆ UTCTimestamp() [1/2]

Engine::UTCTimestamp::UTCTimestamp ( )
throw (
)

Default constructor.

Referenced by getWithoutMilliseconds().

◆ UTCTimestamp() [2/2]

Engine::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

◆ day()

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

Returns day part of value.

◆ dayOfWeek()

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

Returns day of the week.

0 means Sunday, 1 - Monday, 2 - Tuesday, ... 5 - Friday

◆ fromDecimal()

static UTCTimestamp Engine::UTCTimestamp::fromDecimal ( System::u64  val)
throw (
)
static

Constructs object from decimal date format (YYYYMMDDHHMMSSzzz).

◆ fromDecimalString()

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

Constructs object from decimal date format (YYYYMMDDHHMMSSzzz).

◆ fromFixString()

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

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

◆ fromString()

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

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

◆ fromTimeT()

static UTCTimestamp Engine::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)

◆ fromUnixTimeInMillis()

static UTCTimestamp Engine::UTCTimestamp::fromUnixTimeInMillis ( System::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)

◆ getWithoutMilliseconds()

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

Erases milliseconds.

References UTCTimestamp().

◆ hour()

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

Returns day hour of value.

◆ millisecond()

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

Returns day millisecond of value.

◆ minute()

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

Returns day minute of value.

◆ month()

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

Returns month part of value.

◆ now()

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

Returns UTCTimestamp with current time.

Parameters
withMIllisecondsPass to to obtain time with milliseconds; false otherwise.
Returns
Instance of the UTCTimestamp which contains current time.

◆ operator!=()

bool Engine::UTCTimestamp::operator!= ( const UTCTimestamp v) const
throw (
)
inline

Compare operators.

◆ operator<()

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

Compare operators.

◆ operator<=()

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

Compare operators.

◆ operator==()

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

Compare operators.

◆ operator>()

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

Compare operators.

◆ operator>=()

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

Compare operators.

◆ second()

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

Returns day second of value.

◆ toDecimal()

System::u64 Engine::UTCTimestamp::toDecimal ( ) const
throw (
)

Returns value in decimal format (YYYYMMDDHHMMSSzzz)

◆ toFixString() [1/2]

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

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

◆ toFixString() [2/2]

char* Engine::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
Returns
pointer to the first character of the result. Last character of result is last character of the 'buf' parameter.

◆ year()

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

Returns year part of value.

Member Data Documentation

◆ DecimalValueSizeNoMilliseconds

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

Maximum buffer size required to store value.

◆ DecimalValueSizeWithMilliseconds

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

Maximum buffer size required to store value.

◆ ValueSize

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

Maximum buffer size required to store value.

◆ ValueSizeNoMilliseconds

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

Maximum buffer size required to store value.

Referenced by Engine::PreparedMessage::set().

◆ ValueSizeWithMilliseconds

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

Maximum buffer size required to store value.

Referenced by Engine::PreparedMessage::set().