FieldTypes.h
Go to the documentation of this file.
/* -*- C++ -*- */
/****************************************************************************
** Copyright (c) 2001-2014
**
** This file is part of the QuickFIX FIX Engine
**
** This file may be distributed under the terms of the quickfixengine.org
** license as defined by quickfixengine.org and appearing in the file
** LICENSE included in the packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.quickfixengine.org/LICENSE for licensing information.
**
** Contact ask@quickfixengine.org if any conditions of this licensing are
** not clear to you.
**
****************************************************************************/
#ifndef FIX_FIELDTYPES_H
#define FIX_FIELDTYPES_H
#ifdef _MSC_VER
#pragma warning( disable : 4503 4355 4786 4290 )
#endif
#if defined(_MSC_VER) && (_MSC_VER < 1600)
#include "stdint_msvc.h"
#else
#include <stdint.h> /* integer types int8_t .. uint64_t, intptr_t */
#endif
#include "Utility.h"
#include <string>
#include <time.h>
namespace FIX
{
// Precision factor of timestamp. [0] - second, [9] - nanosecond
static const int PRECISION_FACTOR[10] = {1000000000, 100000000, 10000000, 1000000, 100000, 10000, 1000, 100, 10, 1};
struct DateTime
{
int m_date;
int64_t m_time;
static const int64_t SECONDS_PER_DAY = 86400;
static const int64_t SECONDS_PER_HOUR = 3600;
static const int64_t SECONDS_PER_MIN = 60;
static const int64_t MINUTES_PER_HOUR = 60;
static const int64_t NANOS_PER_DAY = 86400000000000;
static const int64_t NANOS_PER_HOUR = 3600000000000;
static const int64_t NANOS_PER_MIN = 60000000000;
static const int64_t NANOS_PER_SEC = 1000000000;
// time_t epoch (1970-01-01) as a Julian date
static const int64_t JULIAN_19700101 = 2440588;
DateTime () : m_date (0), m_time (0) {}
DateTime (int date, int64_t time) : m_date (date), m_time (time) {}
DateTime( int year, int month, int day,
int hour, int minute, int second, int millis )
{
m_date = julianDate( year, month, day );
m_time = makeHMS( hour, minute, second, millis * PRECISION_FACTOR[3] );
}
DateTime( int year, int month, int day,
int hour, int minute, int second, int fraction, int precision )
{
m_date = julianDate( year, month, day );
int nanos = convertToNanos(fraction, precision);
m_time = makeHMS( hour, minute, second, nanos );
}
virtual ~DateTime() {}
inline int getYear() const
{
int y, m, d;
getYMD( y, m, d );
return y;
}
inline int getMonth() const
{
int y, m, d;
getYMD( y, m, d );
return m;
}
inline int getDay() const
{
int y, m, d;
getYMD( y, m, d );
return d;
}
inline int getDate() const { return getDay(); }
inline int getJulianDate() const { return m_date; }
inline int getHour() const
{
return (int)(m_time / NANOS_PER_HOUR);
}
inline int getMinute() const
{
return (m_time / NANOS_PER_MIN) % MINUTES_PER_HOUR;
}
inline int getSecond() const
{
return (m_time / NANOS_PER_SEC) % SECONDS_PER_MIN;
}
inline int getMillisecond() const
{
return (getNanosecond() / PRECISION_FACTOR[3]);
}
inline int getMicroecond() const
{
return (getNanosecond() / PRECISION_FACTOR[6]);
}
inline unsigned int getNanosecond() const
{
return static_cast<uint64_t>(m_time) % NANOS_PER_SEC;
}
inline int getFraction(int precision) const
{
switch (precision)
{
case 0:
return (getNanosecond() / PRECISION_FACTOR[0]);
case 1:
return (getNanosecond() / PRECISION_FACTOR[1]);
case 2:
return (getNanosecond() / PRECISION_FACTOR[2]);
case 3:
return (getNanosecond() / PRECISION_FACTOR[3]);
case 4:
return (getNanosecond() / PRECISION_FACTOR[4]);
case 5:
return (getNanosecond() / PRECISION_FACTOR[5]);
case 6:
return (getNanosecond() / PRECISION_FACTOR[6]);
case 7:
return (getNanosecond() / PRECISION_FACTOR[7]);
case 8:
return (getNanosecond() / PRECISION_FACTOR[8]);
case 9:
default:
return (getNanosecond() / PRECISION_FACTOR[9]);
}
}
inline void getYMD (int& year, int& month, int& day) const
{
getYMD( m_date, year, month, day );
}
inline void getHMS( int& hour, int& minute, int& second, int& millis ) const
{
int ticks = (int)(m_time / NANOS_PER_SEC);
hour = ticks / SECONDS_PER_HOUR;
minute = (ticks / SECONDS_PER_MIN) % MINUTES_PER_HOUR;
second = ticks % SECONDS_PER_MIN;
millis = getMillisecond();
}
inline void getHMS( int& hour, int& minute, int& second, int& fraction, int precision ) const
{
int ticks = (int)(m_time / NANOS_PER_SEC);
hour = ticks / SECONDS_PER_HOUR;
minute = (ticks / SECONDS_PER_MIN) % MINUTES_PER_HOUR;
second = ticks % SECONDS_PER_MIN;
fraction = getFraction(precision);
}
inline int getWeekDay() const
{
int Y, M, D;
getYMD (Y, M, D);
int m = M >= 3 ? M - 2 : M + 10;
int Yprime = M >= 3 ? Y : Y - 1;
int y = Yprime % 100;
int c = Yprime / 100;
int wd = (D + int (2.6 * m - 0.2) + y + int (y / 4) + int (c / 4) -
(2 * c)) % 7;
return 1 + (wd < 0 ? 7 + wd : wd);
}
inline time_t getTimeT() const
{
return (SECONDS_PER_DAY * (m_date - JULIAN_19700101) +
m_time / NANOS_PER_SEC);
}
tm getTmUtc() const
{
int year, month, day;
int hour, minute, second, millis;
tm result = { 0 };
getYMD( year, month, day );
getHMS( hour, minute, second, millis );
result.tm_year = year - 1900;
result.tm_mon = month - 1;
result.tm_mday = day;
result.tm_hour = hour;
result.tm_min = minute;
result.tm_sec = second;
result.tm_isdst = -1;
return result;
}
void setYMD( int year, int month, int day )
{
m_date = julianDate( year, month, day );
}
void setHMS( int hour, int minute, int second, int millis )
{
m_time = makeHMS( hour, minute, second, millis * PRECISION_FACTOR[3] );
}
void setHMS( int hour, int minute, int second, int fraction, int precision )
{
int nanos = convertToNanos(fraction, precision);
m_time = makeHMS( hour, minute, second, nanos);
}
void setHour( int hour )
{
int old_hour, min, sec, millis;
getHMS( old_hour, min, sec, millis );
setHMS( hour, min, sec, millis );
}
void setMinute( int min )
{
int hour, old_min, sec, millis;
getHMS( hour, old_min, sec, millis );
setHMS( hour, min, sec, millis );
}
void setSecond( int sec )
{
int hour, min, old_sec, millis;
getHMS( hour, min, old_sec, millis );
setHMS( hour, min, sec, millis );
}
void setMillisecond( int millis )
{
int hour, min, sec, old_millis;
getHMS( hour, min, sec, old_millis );
setHMS( hour, min, sec, millis );
}
void setMicrosecond( int micros )
{
int hour, min, sec, old_nanos;
getHMS( hour, min, sec, old_nanos, 9 );
setHMS( hour, min, sec, micros, 6 );
}
void setNanosecond( int nanos )
{
int hour, min, sec, old_nanos;
getHMS( hour, min, sec, old_nanos, 9 );
setHMS( hour, min, sec, nanos, 9 );
}
void setFraction( int fraction, int precision )
{
int hour, min, sec, old_nanos;
getHMS( hour, min, sec, old_nanos, 9 );
setHMS( hour, min, sec, fraction, precision );
}
void clearDate()
{
m_date = 0;
}
void clearTime()
{
m_time = 0;
}
void set( int date, int64_t time ) { m_date = date; m_time = time; }
void set( const DateTime& other )
{
m_date = other.m_date;
m_time = other.m_time;
}
void operator+=( int seconds )
{
int d = seconds / SECONDS_PER_DAY;
int s = seconds % SECONDS_PER_DAY;
m_date += d;
m_time += s * NANOS_PER_SEC;
if( m_time > NANOS_PER_DAY )
{
m_date++;
m_time %= NANOS_PER_DAY;
}
else if( m_time < 0 )
{
m_date--;
m_time += NANOS_PER_DAY;
}
}
static int convertToNanos(int fraction, int precision)
{
int nanos;
switch (precision)
{
case 0:
nanos = fraction * PRECISION_FACTOR[0];
break;
case 1:
nanos = fraction * PRECISION_FACTOR[1];
break;
case 2:
nanos = fraction * PRECISION_FACTOR[2];
break;
case 3:
nanos = fraction * PRECISION_FACTOR[3];
break;
case 4:
nanos = fraction * PRECISION_FACTOR[4];
break;
case 5:
nanos = fraction * PRECISION_FACTOR[5];
break;
case 6:
nanos = fraction * PRECISION_FACTOR[6];
break;
case 7:
nanos = fraction * PRECISION_FACTOR[7];
break;
case 8:
nanos = fraction * PRECISION_FACTOR[8];
break;
case 9:
default:
nanos = fraction * PRECISION_FACTOR[9];
break;
}
return nanos;
}
static int64_t makeHMS( int hour, int minute, int second, int nanos )
{
return NANOS_PER_SEC * (SECONDS_PER_HOUR * hour +
SECONDS_PER_MIN * minute +
second) + nanos;
}
static DateTime nowUtc();
static DateTime nowLocal();
static DateTime fromUtcTimeT( time_t t, int millis = 0 )
{
struct tm tm = time_gmtime( &t );
return fromTm( tm, millis );
}
static DateTime fromLocalTimeT( time_t t, int millis = 0 )
{
struct tm tm = time_localtime( &t );
return fromTm( tm, millis );
}
static DateTime fromUtcTimeT( time_t t, int fraction, int precision )
{
struct tm tm = time_gmtime( &t );
return fromTm( tm, fraction, precision );
}
static DateTime fromLocalTimeT( time_t t, int fraction, int precision )
{
struct tm tm = time_localtime( &t );
return fromTm( tm, fraction, precision );
}
static DateTime fromTm( const tm& tm, int millis = 0 )
{
return DateTime ( julianDate(tm.tm_year + 1900, tm.tm_mon + 1,
tm.tm_mday),
makeHMS(tm.tm_hour, tm.tm_min, tm.tm_sec, millis * PRECISION_FACTOR[3]) );
}
static DateTime fromTm( const tm& tm, int fraction, int precision )
{
int nanos = convertToNanos(fraction, precision);
return DateTime ( julianDate(tm.tm_year + 1900, tm.tm_mon + 1,
tm.tm_mday),
makeHMS(tm.tm_hour, tm.tm_min, tm.tm_sec, nanos) );
}
static int julianDate( int year, int month, int day )
{
int a = (14 - month) / 12;
int y = year + 4800 - a;
int m = month + 12 * a - 3;
return (day + int ((153 * m + 2) / 5) + y * 365 +
int (y / 4) - int (y / 100) + int (y / 400) - 32045);
}
static void getYMD( int jday, int& year, int& month, int& day )
{
int a = jday + 32044;
int b = (4 * a + 3) / 146097;
int c = a - int ((b * 146097) / 4);
int d = (4 * c + 3) / 1461;
int e = c - int ((1461 * d) / 4);
int m = (5 * e + 2) / 153;
day = e - int ((153 * m + 2) / 5) + 1;
month = m + 3 - 12 * int (m / 10);
year = b * 100 + d - 4800 + int (m / 10);
}
};
inline bool operator==( const DateTime& lhs, const DateTime& rhs )
{
return lhs.m_date == rhs.m_date && lhs.m_time == rhs.m_time;
}
inline bool operator!=( const DateTime& lhs, const DateTime& rhs )
{
return !(lhs == rhs);
}
inline bool operator<( const DateTime& lhs, const DateTime& rhs )
{
if( lhs.m_date < rhs.m_date )
return true;
else if( lhs.m_date > rhs.m_date )
return false;
else if( lhs.m_time < rhs.m_time )
return true;
return false;
}
inline bool operator>( const DateTime& lhs, const DateTime& rhs )
{
return !(lhs == rhs || lhs < rhs);
}
inline bool operator<=( const DateTime& lhs, const DateTime& rhs )
{
return lhs == rhs || lhs < rhs;
}
inline bool operator>=( const DateTime& lhs, const DateTime& rhs )
{
return lhs == rhs || lhs > rhs;
}
inline int operator-( const DateTime& lhs, const DateTime& rhs )
{
return (DateTime::SECONDS_PER_DAY * (lhs.m_date - rhs.m_date) +
// Truncate the nanos before subtracting
(int)(lhs.m_time / DateTime::NANOS_PER_SEC) - (int)(rhs.m_time / DateTime::NANOS_PER_SEC));
}
class UtcTimeStamp : public DateTime
{
public:
UtcTimeStamp()
: DateTime( DateTime::nowUtc() ) {}
UtcTimeStamp( int hour, int minute, int second, int millisecond = 0 )
: DateTime( DateTime::nowUtc() )
{
setHMS( hour, minute, second, millisecond );
}
UtcTimeStamp( int hour, int minute, int second, int fraction, int precision )
: DateTime( DateTime::nowUtc() )
{
setHMS( hour, minute, second, fraction, precision );
}
UtcTimeStamp( int hour, int minute, int second,
int date, int month, int year )
: DateTime( year, month, date, hour, minute, second, 0 ) {}
UtcTimeStamp( int hour, int minute, int second, int millisecond,
int date, int month, int year )
: DateTime( year, month, date, hour, minute, second, millisecond ) {}
UtcTimeStamp( int hour, int minute, int second, int fraction,
int date, int month, int year, int precision )
: DateTime( year, month, date, hour, minute, second, fraction, precision ) {}
explicit UtcTimeStamp( time_t time, int millisecond = 0 )
: DateTime( fromUtcTimeT (time, millisecond) ) {}
UtcTimeStamp( time_t time, int fraction, int precision )
: DateTime( fromUtcTimeT (time, fraction, precision) ) {}
UtcTimeStamp( const tm* time, int millisecond = 0 )
: DateTime( fromTm (*time, millisecond) ) {}
UtcTimeStamp( const tm* time, int fraction, int precision )
: DateTime( fromTm (*time, fraction, precision) ) {}
void setCurrent()
{
set( DateTime::nowUtc() );
}
};
class LocalTimeStamp : public DateTime
{
public:
LocalTimeStamp()
: DateTime( DateTime::nowLocal() ) {}
LocalTimeStamp( int hour, int minute, int second, int millisecond = 0 )
: DateTime( DateTime::nowLocal() )
{
setHMS( hour, minute, second, millisecond );
}
LocalTimeStamp( int hour, int minute, int second, int fraction, int precision )
: DateTime( DateTime::nowLocal() )
{
setHMS( hour, minute, second, fraction, precision );
}
LocalTimeStamp( int hour, int minute, int second,
int date, int month, int year )
: DateTime( year, month, date, hour, minute, second, 0 ) {}
LocalTimeStamp( int hour, int minute, int second, int millisecond,
int date, int month, int year )
: DateTime( year, month, date, hour, minute, second, millisecond ) {}
LocalTimeStamp( int hour, int minute, int second, int fraction,
int date, int month, int year, int precision )
: DateTime( year, month, date, hour, minute, second, fraction, precision ) {}
explicit LocalTimeStamp( time_t time, int millisecond = 0 )
: DateTime( fromLocalTimeT (time, millisecond) ) {}
LocalTimeStamp( time_t time, int fraction, int precision )
: DateTime( fromLocalTimeT (time, fraction, precision) ) {}
LocalTimeStamp( const tm* time, int millisecond = 0 )
: DateTime( fromTm (*time, millisecond) ) {}
LocalTimeStamp( const tm* time, int fraction, int precision )
: DateTime( fromTm (*time, fraction, precision) ) {}
void setCurrent()
{
set( DateTime::nowLocal() );
}
};
class UtcTimeOnly : public DateTime
{
public:
UtcTimeOnly()
{
setCurrent();
}
UtcTimeOnly( const DateTime& val )
: DateTime(val)
{
clearDate();
}
UtcTimeOnly( int hour, int minute, int second, int millisecond = 0 )
{
setHMS( hour, minute, second, millisecond );
}
UtcTimeOnly( int hour, int minute, int second, int fraction, int precision )
{
setHMS( hour, minute, second, fraction, precision );
}
explicit UtcTimeOnly( time_t time, int millisecond = 0 )
: DateTime( fromUtcTimeT (time, millisecond) )
{
clearDate();
}
UtcTimeOnly( time_t time, int fraction, int precision )
: DateTime( fromUtcTimeT (time, fraction, precision) )
{
clearDate();
}
UtcTimeOnly( const tm* time, int millisecond = 0 )
: DateTime( fromTm (*time, millisecond) )
{
clearDate();
}
UtcTimeOnly( const tm* time, int fraction, int precision )
: DateTime( fromTm (*time, fraction, precision) )
{
clearDate();
}
void setCurrent()
{
DateTime d = nowUtc();
m_time = d.m_time;
}
};
class LocalTimeOnly : public DateTime
{
public:
LocalTimeOnly()
{
setCurrent();
}
LocalTimeOnly( const DateTime& val )
: DateTime(val)
{
clearDate();
}
LocalTimeOnly( int hour, int minute, int second, int millisecond = 0 )
{
setHMS( hour, minute, second, millisecond );
}
LocalTimeOnly( int hour, int minute, int second, int fraction, int precision )
{
setHMS( hour, minute, second, fraction, precision );
}
explicit LocalTimeOnly( time_t time, int millisecond = 0 )
: DateTime( fromLocalTimeT (time, millisecond) )
{
clearDate();
}
LocalTimeOnly( time_t time, int fraction, int precision )
: DateTime( fromLocalTimeT (time, fraction, precision) )
{
clearDate();
}
LocalTimeOnly( const tm* time, int millisecond = 0 )
: DateTime( fromTm (*time, millisecond) )
{
clearDate();
}
LocalTimeOnly( const tm* time, int fraction, int precision )
: DateTime( fromTm (*time, fraction, precision) )
{
clearDate();
}
void setCurrent()
{
DateTime d = nowLocal();
m_time = d.m_time;
}
};
class UtcDate : public DateTime
{
public:
UtcDate()
{
setCurrent();
}
UtcDate( const DateTime& val )
: DateTime( val )
{
clearTime();
}
UtcDate( int date, int month, int year )
: DateTime(year, month, date, 0, 0, 0, 0) {}
UtcDate( int sec )
: DateTime( sec / DateTime::SECONDS_PER_DAY, 0 ) {}
UtcDate( const tm* time )
: DateTime( fromTm (*time) )
{
clearTime();
}
void setCurrent()
{
DateTime d = nowUtc();
m_date = d.m_date;
}
};
class LocalDate : public DateTime
{
public:
LocalDate()
{
setCurrent();
}
LocalDate( const DateTime& val )
: DateTime( val )
{
clearTime();
}
LocalDate( int date, int month, int year )
: DateTime(year, month, date, 0, 0, 0, 0) {}
LocalDate( int sec )
: DateTime( sec / DateTime::SECONDS_PER_DAY, 0 ) {}
LocalDate( const tm* time )
: DateTime( fromTm (*time) )
{
clearTime();
}
void setCurrent()
{
DateTime d = nowLocal();
m_date = d.m_date;
}
};
typedef UtcDate UtcDateOnly;
typedef std::string STRING;
typedef char CHAR;
typedef double PRICE;
typedef int INT;
typedef double AMT;
typedef double QTY;
typedef std::string CURRENCY;
typedef std::string MULTIPLEVALUESTRING;
typedef std::string MULTIPLESTRINGVALUE;
typedef std::string MULTIPLECHARVALUE;
typedef std::string EXCHANGE;
typedef UtcTimeStamp UTCTIMESTAMP;
typedef bool BOOLEAN;
typedef std::string LOCALMKTDATE;
typedef std::string DATA;
typedef double FLOAT;
typedef double PRICEOFFSET;
typedef std::string MONTHYEAR;
typedef std::string DAYOFMONTH;
typedef UtcDate UTCDATE;
typedef UtcDateOnly UTCDATEONLY;
typedef UtcTimeOnly UTCTIMEONLY;
typedef int NUMINGROUP;
typedef double PERCENTAGE;
typedef int SEQNUM;
typedef int LENGTH;
typedef std::string COUNTRY;
typedef std::string TZTIMEONLY;
typedef std::string TZTIMESTAMP;
typedef std::string XMLDATA;
typedef std::string LANGUAGE;
namespace TYPE
{
enum Type
{
Unknown,
String,
Char,
Price,
Int,
Amt,
Qty,
Currency,
MultipleValueString,
MultipleStringValue,
MultipleCharValue,
Exchange,
UtcTimeStamp,
Boolean,
LocalMktDate,
Data,
Float,
PriceOffset,
MonthYear,
DayOfMonth,
UtcDate,
UtcDateOnly = UtcDate,
UtcTimeOnly,
NumInGroup,
Percentage,
SeqNum,
Length,
Country,
TzTimeOnly,
TzTimeStamp,
XmlData,
Language
};
}
}
#endif //FIX_FIELDTYPES_H
Utility.h
FIX::LocalDate
Date only represented in local time.
Definition FieldTypes.h:837
FIX::LocalDate::LocalDate
LocalDate(const tm *time)
Definition FieldTypes.h:857
FIX::LocalDate::LocalDate
LocalDate(int date, int month, int year)
Definition FieldTypes.h:851
FIX::LocalDate::LocalDate
LocalDate(int sec)
Definition FieldTypes.h:854
FIX::LocalDate::LocalDate
LocalDate(const DateTime &val)
Definition FieldTypes.h:845
FIX::LocalDate::setCurrent
void setCurrent()
Set to the current time.
Definition FieldTypes.h:864
FIX::LocalDate::LocalDate
LocalDate()
Defaults to the current date.
Definition FieldTypes.h:840
FIX::LocalTimeOnly
Time only represented in local time.
Definition FieldTypes.h:743
FIX::LocalTimeOnly::LocalTimeOnly
LocalTimeOnly(const tm *time, int millisecond=0)
Definition FieldTypes.h:779
FIX::LocalTimeOnly::LocalTimeOnly
LocalTimeOnly(time_t time, int fraction, int precision)
Definition FieldTypes.h:773
FIX::LocalTimeOnly::LocalTimeOnly
LocalTimeOnly()
Defaults to the current time.
Definition FieldTypes.h:746
FIX::LocalTimeOnly::LocalTimeOnly
LocalTimeOnly(const DateTime &val)
Definition FieldTypes.h:751
FIX::LocalTimeOnly::LocalTimeOnly
LocalTimeOnly(int hour, int minute, int second, int millisecond=0)
Definition FieldTypes.h:757
FIX::LocalTimeOnly::LocalTimeOnly
LocalTimeOnly(time_t time, int millisecond=0)
Definition FieldTypes.h:767
FIX::LocalTimeOnly::setCurrent
void setCurrent()
Set to the current time.
Definition FieldTypes.h:792
FIX::LocalTimeOnly::LocalTimeOnly
LocalTimeOnly(const tm *time, int fraction, int precision)
Definition FieldTypes.h:785
FIX::LocalTimeOnly::LocalTimeOnly
LocalTimeOnly(int hour, int minute, int second, int fraction, int precision)
Definition FieldTypes.h:762
FIX::LocalTimeStamp
Date and Time represented in local time.
Definition FieldTypes.h:634
FIX::LocalTimeStamp::LocalTimeStamp
LocalTimeStamp(int hour, int minute, int second, int millisecond, int date, int month, int year)
Definition FieldTypes.h:657
FIX::LocalTimeStamp::setCurrent
void setCurrent()
Definition FieldTypes.h:677
FIX::LocalTimeStamp::LocalTimeStamp
LocalTimeStamp(time_t time, int fraction, int precision)
Definition FieldTypes.h:668
FIX::LocalTimeStamp::LocalTimeStamp
LocalTimeStamp(const tm *time, int millisecond=0)
Definition FieldTypes.h:671
FIX::LocalTimeStamp::LocalTimeStamp
LocalTimeStamp()
Defaults to the current date and time.
Definition FieldTypes.h:637
FIX::LocalTimeStamp::LocalTimeStamp
LocalTimeStamp(const tm *time, int fraction, int precision)
Definition FieldTypes.h:674
FIX::LocalTimeStamp::LocalTimeStamp
LocalTimeStamp(int hour, int minute, int second, int fraction, int precision)
Definition FieldTypes.h:647
FIX::LocalTimeStamp::LocalTimeStamp
LocalTimeStamp(int hour, int minute, int second, int date, int month, int year)
Definition FieldTypes.h:653
FIX::LocalTimeStamp::LocalTimeStamp
LocalTimeStamp(time_t time, int millisecond=0)
Definition FieldTypes.h:665
FIX::LocalTimeStamp::LocalTimeStamp
LocalTimeStamp(int hour, int minute, int second, int millisecond=0)
Defaults to the current date.
Definition FieldTypes.h:641
FIX::LocalTimeStamp::LocalTimeStamp
LocalTimeStamp(int hour, int minute, int second, int fraction, int date, int month, int year, int precision)
Definition FieldTypes.h:661
FIX::UtcDate
Date only represented in UTC.
Definition FieldTypes.h:801
FIX::UtcDate::setCurrent
void setCurrent()
Set to the current time.
Definition FieldTypes.h:828
FIX::UtcDate::UtcDate
UtcDate(const tm *time)
Definition FieldTypes.h:821
FIX::UtcDate::UtcDate
UtcDate(const DateTime &val)
Definition FieldTypes.h:809
FIX::UtcDate::UtcDate
UtcDate()
Defaults to the current date.
Definition FieldTypes.h:804
FIX::UtcDate::UtcDate
UtcDate(int date, int month, int year)
Definition FieldTypes.h:815
FIX::UtcDate::UtcDate
UtcDate(int sec)
Definition FieldTypes.h:818
FIX::UtcTimeOnly
Time only represented in UTC.
Definition FieldTypes.h:685
FIX::UtcTimeOnly::UtcTimeOnly
UtcTimeOnly(time_t time, int millisecond=0)
Definition FieldTypes.h:709
FIX::UtcTimeOnly::UtcTimeOnly
UtcTimeOnly()
Defaults to the current time.
Definition FieldTypes.h:688
FIX::UtcTimeOnly::setCurrent
void setCurrent()
Set to the current time.
Definition FieldTypes.h:734
FIX::UtcTimeOnly::UtcTimeOnly
UtcTimeOnly(int hour, int minute, int second, int fraction, int precision)
Definition FieldTypes.h:704
FIX::UtcTimeOnly::UtcTimeOnly
UtcTimeOnly(int hour, int minute, int second, int millisecond=0)
Definition FieldTypes.h:699
FIX::UtcTimeOnly::UtcTimeOnly
UtcTimeOnly(const tm *time, int fraction, int precision)
Definition FieldTypes.h:727
FIX::UtcTimeOnly::UtcTimeOnly
UtcTimeOnly(const tm *time, int millisecond=0)
Definition FieldTypes.h:721
FIX::UtcTimeOnly::UtcTimeOnly
UtcTimeOnly(time_t time, int fraction, int precision)
Definition FieldTypes.h:715
FIX::UtcTimeOnly::UtcTimeOnly
UtcTimeOnly(const DateTime &val)
Definition FieldTypes.h:693
FIX::UtcTimeStamp
Date and Time represented in UTC.
Definition FieldTypes.h:583
FIX::UtcTimeStamp::UtcTimeStamp
UtcTimeStamp(int hour, int minute, int second, int fraction, int date, int month, int year, int precision)
Definition FieldTypes.h:610
FIX::UtcTimeStamp::UtcTimeStamp
UtcTimeStamp(time_t time, int millisecond=0)
Definition FieldTypes.h:614
FIX::UtcTimeStamp::UtcTimeStamp
UtcTimeStamp(int hour, int minute, int second, int date, int month, int year)
Definition FieldTypes.h:602
FIX::UtcTimeStamp::UtcTimeStamp
UtcTimeStamp(int hour, int minute, int second, int millisecond=0)
Defaults to the current date.
Definition FieldTypes.h:590
FIX::UtcTimeStamp::UtcTimeStamp
UtcTimeStamp(int hour, int minute, int second, int fraction, int precision)
Definition FieldTypes.h:596
FIX::UtcTimeStamp::UtcTimeStamp
UtcTimeStamp(time_t time, int fraction, int precision)
Definition FieldTypes.h:617
FIX::UtcTimeStamp::UtcTimeStamp
UtcTimeStamp(const tm *time, int millisecond=0)
Definition FieldTypes.h:620
FIX::UtcTimeStamp::UtcTimeStamp
UtcTimeStamp(const tm *time, int fraction, int precision)
Definition FieldTypes.h:623
FIX::UtcTimeStamp::UtcTimeStamp
UtcTimeStamp(int hour, int minute, int second, int millisecond, int date, int month, int year)
Definition FieldTypes.h:606
FIX::UtcTimeStamp::setCurrent
void setCurrent()
Definition FieldTypes.h:626
FIX::UtcTimeStamp::UtcTimeStamp
UtcTimeStamp()
Defaults to the current date and time.
Definition FieldTypes.h:586
FIX::PRECISION_FACTOR
static const int PRECISION_FACTOR[10]
Date and Time stored as a Julian day number and number of nanoseconds since midnight.
Definition FieldTypes.h:58
FIX::operator-
int operator-(const DateTime &lhs, const DateTime &rhs)
Calculate the difference between two DateTime values and return the result as a number of seconds.
Definition FieldTypes.h:574
FIX::TYPE::Type
Type
Definition FieldTypes.h:910
FIX::TYPE::UtcTimeOnly
@ UtcTimeOnly
Definition FieldTypes.h:933
FIX::TYPE::Boolean
@ Boolean
Definition FieldTypes.h:924
FIX::TYPE::NumInGroup
@ NumInGroup
Definition FieldTypes.h:934
FIX::TYPE::Int
@ Int
Definition FieldTypes.h:915
FIX::TYPE::MultipleValueString
@ MultipleValueString
Definition FieldTypes.h:919
FIX::TYPE::DayOfMonth
@ DayOfMonth
Definition FieldTypes.h:930
FIX::TYPE::UtcDate
@ UtcDate
Definition FieldTypes.h:931
FIX::TYPE::PriceOffset
@ PriceOffset
Definition FieldTypes.h:928
FIX::TYPE::Price
@ Price
Definition FieldTypes.h:914
FIX::TYPE::TzTimeStamp
@ TzTimeStamp
Definition FieldTypes.h:940
FIX::TYPE::Exchange
@ Exchange
Definition FieldTypes.h:922
FIX::TYPE::XmlData
@ XmlData
Definition FieldTypes.h:941
FIX::TYPE::MultipleStringValue
@ MultipleStringValue
Definition FieldTypes.h:920
FIX::TYPE::TzTimeOnly
@ TzTimeOnly
Definition FieldTypes.h:939
FIX::TYPE::MultipleCharValue
@ MultipleCharValue
Definition FieldTypes.h:921
FIX::TYPE::Currency
@ Currency
Definition FieldTypes.h:918
FIX::TYPE::UtcTimeStamp
@ UtcTimeStamp
Definition FieldTypes.h:923
FIX::TYPE::MonthYear
@ MonthYear
Definition FieldTypes.h:929
FIX::TYPE::String
@ String
Definition FieldTypes.h:912
FIX::TYPE::Char
@ Char
Definition FieldTypes.h:913
FIX::TYPE::Country
@ Country
Definition FieldTypes.h:938
FIX::TYPE::Float
@ Float
Definition FieldTypes.h:927
FIX::TYPE::SeqNum
@ SeqNum
Definition FieldTypes.h:936
FIX::TYPE::Percentage
@ Percentage
Definition FieldTypes.h:935
FIX::TYPE::Qty
@ Qty
Definition FieldTypes.h:917
FIX::TYPE::Unknown
@ Unknown
Definition FieldTypes.h:911
FIX::TYPE::LocalMktDate
@ LocalMktDate
Definition FieldTypes.h:925
FIX::TYPE::Length
@ Length
Definition FieldTypes.h:937
FIX::TYPE::Language
@ Language
Definition FieldTypes.h:942
FIX::TYPE::Amt
@ Amt
Definition FieldTypes.h:916
FIX::TYPE::Data
@ Data
Definition FieldTypes.h:926
FIX
Definition Acceptor.cpp:35
FIX::STRING
std::string STRING
Definition FieldTypes.h:875
FIX::EXCHANGE
std::string EXCHANGE
Definition FieldTypes.h:885
FIX::operator==
bool operator==(const DatabaseConnectionID &lhs, const DatabaseConnectionID &rhs)
Definition DatabaseConnectionID.h:91
FIX::LANGUAGE
std::string LANGUAGE
Definition FieldTypes.h:905
FIX::MONTHYEAR
std::string MONTHYEAR
Definition FieldTypes.h:892
FIX::UTCDATE
UtcDate UTCDATE
Definition FieldTypes.h:894
FIX::operator>
bool operator>(const StringField &lhs, const char *rhs)
Definition Field.h:316
FIX::MULTIPLECHARVALUE
std::string MULTIPLECHARVALUE
Definition FieldTypes.h:884
FIX::time_localtime
tm time_localtime(const time_t *t)
Definition Utility.cpp:400
FIX::XMLDATA
std::string XMLDATA
Definition FieldTypes.h:904
FIX::DAYOFMONTH
std::string DAYOFMONTH
Definition FieldTypes.h:893
FIX::MULTIPLESTRINGVALUE
std::string MULTIPLESTRINGVALUE
Definition FieldTypes.h:883
FIX::UTCTIMEONLY
UtcTimeOnly UTCTIMEONLY
Definition FieldTypes.h:896
FIX::NUMINGROUP
int NUMINGROUP
Definition FieldTypes.h:897
FIX::operator<
bool operator<(const DatabaseConnectionID &lhs, const DatabaseConnectionID &rhs)
Definition DatabaseConnectionID.h:66
FIX::time_gmtime
tm time_gmtime(const time_t *t)
Definition Utility.cpp:384
FIX::TZTIMESTAMP
std::string TZTIMESTAMP
Definition FieldTypes.h:903
FIX::UTCDATEONLY
UtcDateOnly UTCDATEONLY
Definition FieldTypes.h:895
FIX::CURRENCY
std::string CURRENCY
Definition FieldTypes.h:881
FIX::operator<=
bool operator<=(const StringField &lhs, const char *rhs)
Definition Field.h:328
FIX::MULTIPLEVALUESTRING
std::string MULTIPLEVALUESTRING
Definition FieldTypes.h:882
FIX::UTCTIMESTAMP
UtcTimeStamp UTCTIMESTAMP
Definition FieldTypes.h:886
FIX::DATA
std::string DATA
Definition FieldTypes.h:889
FIX::LENGTH
int LENGTH
Definition FieldTypes.h:900
FIX::operator!=
bool operator!=(const DatabaseConnectionID &lhs, const DatabaseConnectionID &rhs)
Definition DatabaseConnectionID.h:99
FIX::BOOLEAN
bool BOOLEAN
Definition FieldTypes.h:887
FIX::AMT
double AMT
Definition FieldTypes.h:879
FIX::operator>=
bool operator>=(const StringField &lhs, const char *rhs)
Definition Field.h:332
FIX::COUNTRY
std::string COUNTRY
Definition FieldTypes.h:901
FIX::LOCALMKTDATE
std::string LOCALMKTDATE
Definition FieldTypes.h:888
FIX::SEQNUM
int SEQNUM
Definition FieldTypes.h:899
FIX::FLOAT
double FLOAT
Definition FieldTypes.h:890
FIX::TZTIMEONLY
std::string TZTIMEONLY
Definition FieldTypes.h:902
FIX::INT
int INT
Definition FieldTypes.h:878
FIX::QTY
double QTY
Definition FieldTypes.h:880
FIX::PRICEOFFSET
double PRICEOFFSET
Definition FieldTypes.h:891
FIX::UtcDateOnly
UtcDate UtcDateOnly
Definition FieldTypes.h:873
FIX::PRICE
double PRICE
Definition FieldTypes.h:877
FIX::CHAR
char CHAR
Definition FieldTypes.h:876
FIX::PERCENTAGE
double PERCENTAGE
Definition FieldTypes.h:898
stdint_msvc.h
int64_t
signed __int64 int64_t
Definition stdint_msvc.h:90
uint64_t
unsigned __int64 uint64_t
Definition stdint_msvc.h:91
FIX::DateTime
Definition FieldTypes.h:61
FIX::DateTime::getDate
int getDate() const
Another name for the day of the month.
Definition FieldTypes.h:130
FIX::DateTime::setHour
void setHour(int hour)
Set the hour portion of the time.
Definition FieldTypes.h:302
FIX::DateTime::getSecond
int getSecond() const
Return the second portion of the time (0-59)
Definition FieldTypes.h:148
FIX::DateTime::SECONDS_PER_HOUR
static const int64_t SECONDS_PER_HOUR
Definition FieldTypes.h:67
FIX::DateTime::clearTime
void clearTime()
Clear the time portion of the DateTime.
Definition FieldTypes.h:364
FIX::DateTime::SECONDS_PER_DAY
static const int64_t SECONDS_PER_DAY
Magic numbers.
Definition FieldTypes.h:66
FIX::DateTime::DateTime
DateTime(int year, int month, int day, int hour, int minute, int second, int fraction, int precision)
Construct from the specified components.
Definition FieldTypes.h:94
FIX::DateTime::operator+=
void operator+=(int seconds)
Add a number of seconds to this.
Definition FieldTypes.h:380
FIX::DateTime::getTmUtc
tm getTmUtc() const
Convert the DateTime to a struct tm which is in UTC.
Definition FieldTypes.h:261
FIX::DateTime::getMinute
int getMinute() const
Return the minute portion of the time (0-59)
Definition FieldTypes.h:142
FIX::DateTime::fromTm
static DateTime fromTm(const tm &tm, int millis=0)
Convert a tm and optional milliseconds to a DateTime.
Definition FieldTypes.h:494
FIX::DateTime::makeHMS
static int64_t makeHMS(int hour, int minute, int second, int nanos)
Helper method to convert a broken down time to a number of nanoseconds since midnight.
Definition FieldTypes.h:454
FIX::DateTime::getYMD
void getYMD(int &year, int &month, int &day) const
Load the referenced values with the year, month and day portions of the date in a single operation.
Definition FieldTypes.h:211
FIX::DateTime::getMillisecond
int getMillisecond() const
Return the millisecond portion of the time (0-999)
Definition FieldTypes.h:154
FIX::DateTime::convertToNanos
static int convertToNanos(int fraction, int precision)
Convert to internal nanos.
Definition FieldTypes.h:401
FIX::DateTime::julianDate
static int julianDate(int year, int month, int day)
Helper method to calculate a Julian day number.
Definition FieldTypes.h:512
FIX::DateTime::m_time
int64_t m_time
Definition FieldTypes.h:63
FIX::DateTime::set
void set(const DateTime &other)
Initialize from another DateTime.
Definition FieldTypes.h:373
FIX::DateTime::getDay
int getDay() const
Return the day of the month portion of the date.
Definition FieldTypes.h:121
FIX::DateTime::getTimeT
time_t getTimeT() const
Convert the DateTime to a time_t.
Definition FieldTypes.h:254
FIX::DateTime::DateTime
DateTime()
Default constructor - initializes to zero.
Definition FieldTypes.h:80
FIX::DateTime::fromUtcTimeT
static DateTime fromUtcTimeT(time_t t, int millis=0)
Convert a time_t and optional milliseconds to a DateTime.
Definition FieldTypes.h:468
FIX::DateTime::setHMS
void setHMS(int hour, int minute, int second, int millis)
Set the time portion of the DateTime.
Definition FieldTypes.h:288
FIX::DateTime::fromUtcTimeT
static DateTime fromUtcTimeT(time_t t, int fraction, int precision)
Definition FieldTypes.h:480
FIX::DateTime::NANOS_PER_HOUR
static const int64_t NANOS_PER_HOUR
Definition FieldTypes.h:72
FIX::DateTime::getNanosecond
unsigned int getNanosecond() const
Return the nanosecond portion of the time.
Definition FieldTypes.h:166
FIX::DateTime::getWeekDay
int getWeekDay() const
Calculate the weekday of the date (Sunday is 1, Saturday is 7)
Definition FieldTypes.h:239
FIX::DateTime::JULIAN_19700101
static const int64_t JULIAN_19700101
Definition FieldTypes.h:77
FIX::DateTime::DateTime
DateTime(int date, int64_t time)
Construct from a Julian day number and time in millis.
Definition FieldTypes.h:83
FIX::DateTime::clearDate
void clearDate()
Clear the date portion of the DateTime.
Definition FieldTypes.h:358
FIX::DateTime::fromTm
static DateTime fromTm(const tm &tm, int fraction, int precision)
Convert a tm and optional milliseconds to a DateTime.
Definition FieldTypes.h:503
FIX::DateTime::setMillisecond
void setMillisecond(int millis)
Set the millisecond portion of the time.
Definition FieldTypes.h:326
FIX::DateTime::setMicrosecond
void setMicrosecond(int micros)
Set the microsecond portion of the time.
Definition FieldTypes.h:334
FIX::DateTime::getMonth
int getMonth() const
Return the month (1-12) portion of the date.
Definition FieldTypes.h:113
FIX::DateTime::getJulianDate
int getJulianDate() const
Return the internal julian date.
Definition FieldTypes.h:133
FIX::DateTime::setYMD
void setYMD(int year, int month, int day)
Set the date portion of the DateTime.
Definition FieldTypes.h:282
FIX::DateTime::getHMS
void getHMS(int &hour, int &minute, int &second, int &millis) const
Load the referenced values with the hour, minute, second and millisecond portions of the time in a si...
Definition FieldTypes.h:218
FIX::DateTime::setHMS
void setHMS(int hour, int minute, int second, int fraction, int precision)
Set the time portion of the DateTime.
Definition FieldTypes.h:294
FIX::DateTime::~DateTime
virtual ~DateTime()
Definition FieldTypes.h:102
FIX::DateTime::SECONDS_PER_MIN
static const int64_t SECONDS_PER_MIN
Definition FieldTypes.h:68
FIX::DateTime::setNanosecond
void setNanosecond(int nanos)
Set the nanosecond portion of the time.
Definition FieldTypes.h:342
FIX::DateTime::set
void set(int date, int64_t time)
Set the internal date and time members.
Definition FieldTypes.h:370
FIX::DateTime::getFraction
int getFraction(int precision) const
Return the fraction portion of the time.
Definition FieldTypes.h:172
FIX::DateTime::setMinute
void setMinute(int min)
Set the minute portion of the time.
Definition FieldTypes.h:310
FIX::DateTime::nowLocal
static DateTime nowLocal()
Return the current wall-clock time as a local DateTime.
Definition FieldTypes.cpp:49
FIX::DateTime::getYMD
static void getYMD(int jday, int &year, int &month, int &day)
Convert a Julian day number to a year, month and day.
Definition FieldTypes.h:522
FIX::DateTime::getHour
int getHour() const
Return the hour portion of the time (0-23)
Definition FieldTypes.h:136
FIX::DateTime::setSecond
void setSecond(int sec)
Set the seconds portion of the time.
Definition FieldTypes.h:318
FIX::DateTime::NANOS_PER_MIN
static const int64_t NANOS_PER_MIN
Definition FieldTypes.h:73
FIX::DateTime::DateTime
DateTime(int year, int month, int day, int hour, int minute, int second, int millis)
Construct from the specified components.
Definition FieldTypes.h:86
FIX::DateTime::getYear
int getYear() const
Return the year portion of the date.
Definition FieldTypes.h:105
FIX::DateTime::fromLocalTimeT
static DateTime fromLocalTimeT(time_t t, int fraction, int precision)
Definition FieldTypes.h:486
FIX::DateTime::nowUtc
static DateTime nowUtc()
Return the current wall-clock time as a utc DateTime.
Definition FieldTypes.cpp:34
FIX::DateTime::getMicroecond
int getMicroecond() const
Return the microsecond portion of the time.
Definition FieldTypes.h:160
FIX::DateTime::m_date
int m_date
Definition FieldTypes.h:62
FIX::DateTime::setFraction
void setFraction(int fraction, int precision)
Set the fraction portion of the time.
Definition FieldTypes.h:350
FIX::DateTime::getHMS
void getHMS(int &hour, int &minute, int &second, int &fraction, int precision) const
Load the referenced values with the hour, minute, second and fraction portions of the time in a singl...
Definition FieldTypes.h:229
FIX::DateTime::MINUTES_PER_HOUR
static const int64_t MINUTES_PER_HOUR
Definition FieldTypes.h:69
FIX::DateTime::NANOS_PER_DAY
static const int64_t NANOS_PER_DAY
Definition FieldTypes.h:71
FIX::DateTime::NANOS_PER_SEC
static const int64_t NANOS_PER_SEC
Definition FieldTypes.h:74
FIX::DateTime::fromLocalTimeT
static DateTime fromLocalTimeT(time_t t, int millis=0)
Definition FieldTypes.h:474