EPAM B2BITS C++ Bovespa MarketData handler  1.28.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Classes | Enumerations | Functions | Variables
B2bits::TZTimeHelper Namespace Reference

Classes

struct  UTCTimeOnly
 
struct  TZTimeOnly
 
struct  UTCDateOnly
 
struct  UTCTimestamp
 
struct  TZTimestamp
 

Enumerations

enum  TimeFlags {
  Seconds = 0x01, Milliseconds = 0x02 | Seconds, Microseconds = 0x04 | Milliseconds, Nanoseconds = 0x08 | Microseconds,
  Picoseconds = 0x10 | Nanoseconds, TrimTrailingZeros = 0x80, MillisecondsAndTrim = Milliseconds | TrimTrailingZeros, MicrosecondsAndTrim = Microseconds | TrimTrailingZeros,
  NanosecondsAndTrim = Nanoseconds | TrimTrailingZeros, PicosecondsAndTrim = Picoseconds | TrimTrailingZeros
}
 

Functions

bool parseUTCTimeOnly (const char *data, size_t lenght, UTCTimeOnly &time)
 
bool parseUTCTimestamp (const char *data, size_t lenght, UTCTimestamp &timestamp)
 
bool parseDateOnly (const char *data, size_t lenght, UTCDateOnly &date)
 
bool parseTimeOnly (const char *data, size_t lenght, TZTimeOnly &time)
 
bool parseTimestamp (const char *data, size_t lenght, TZTimestamp &timestamp)
 
size_t tzTimeOnlyToString (char *data, size_t lenght, const TZTimeOnly &time, TimeFlags flags=Milliseconds)
 
size_t utcTimeOnlyToString (char *data, size_t lenght, const UTCTimeOnly &time, TimeFlags flags=Milliseconds)
 
size_t utcDateOnlyToString (char *data, size_t lenght, const UTCDateOnly date)
 
size_t utcTimestampToString (char *data, size_t lenght, const UTCTimestamp &timestamp, TimeFlags flags=Milliseconds)
 
size_t tzTimestampToString (char *data, size_t lenght, const TZTimestamp &timestamp, TimeFlags flags)
 
void nowTZTimeOnly (TZTimeOnly &time)
 
TZTimeOnly nowTZTimeOnly ()
 Get current time in local time zone. More...
 
void nowUTCTimeOnly (UTCTimeOnly &time)
 
UTCTimeOnly nowUTCTimeOnly ()
 Get current time in UTC. More...
 
void nowTZDateOnly (UTCDateOnly &date)
 
UTCDateOnly nowTZDateOnly ()
 Get current date with local time zone. More...
 
void nowUTCDateOnly (UTCDateOnly &date)
 
UTCDateOnly nowUTCDateOnly ()
 Get current date in UTC. More...
 
void nowTZTimestamp (TZTimestamp &timestamp)
 
TZTimestamp nowTZTimestamp ()
 Get current time and date in local time zone. More...
 
void nowUTCTimestamp (UTCTimestamp &timestamp)
 
UTCTimestamp nowUTCTimestamp ()
 Get current date and time in UTC. More...
 
void utcTimestampFromTZTimestamp (UTCTimestamp &utcTimestamp, const TZTimestamp &tzTimestamp)
 
time_t timeTFromTZTimestamp (const TZTimestamp &timestamp, bool convertToUTC=true)
 
time_t timeTFromUTCTimestamp (const UTCTimestamp &timestamp)
 
void tzTimestampFromTimeT (TZTimestamp &timestamp, time_t time_utc, i16 utcOffset=0)
 
void utcTimestampFromTimeT (UTCTimestamp &timestamp, time_t time_utc)
 
void timeSpecFromTZTimestamp (struct timespec &ts, const TZTimestamp &timestamp, bool convertToUTC=true)
 
void timeSpecTFromUTCTimestamp (struct timespec &ts, const UTCTimestamp &timestamp)
 
void tzTimestampFromTimeSpec (TZTimestamp &timestamp, const struct timespec &ts, i16 utcOffset=0)
 
void utcTimestampFromTimeSpec (UTCTimestamp &timestamp, const struct timespec &ts)
 

Variables

static const unsigned int ValueSizeBufferUTCTimeOnly = sizeof( "HH:MM:SS.ssssssssssss" )-1
 
static const unsigned int ValueSizeBufferTZTimeOnly = sizeof( "HH:MM:SS.ssssssssssss+OO:OO" )-1
 
static const unsigned int ValueSizeBufferUTCDateOnly = sizeof( "YYYYMMDD" )-1
 
static const unsigned int ValueSizeBufferUTCTimestamp = sizeof( "YYYYMMDD-HH:MM:SS.ssssssssssss" )-1
 
static const unsigned int ValueSizeBufferTZTimestamp = sizeof( "YYYYMMDD-HH:MM:SS.ssssssssssss+OO:OO" )-1
 
static const unsigned int ValueSizeUTCTimestampPico = sizeof( "YYYYMMDD-HH:MM:SS.ssssssssssss" )-1
 
static const unsigned int ValueSizeUTCTimestampNano = sizeof( "YYYYMMDD-HH:MM:SS.sssssssss" )-1
 
static const unsigned int ValueSizeUTCTimestampMicro = sizeof( "YYYYMMDD-HH:MM:SS.ssssss" )-1
 
static const unsigned int ValueSizeUTCTimestampMilli = sizeof( "YYYYMMDD-HH:MM:SS.sss" )-1
 
static const unsigned int ValueSizeUTCTimestampSec = sizeof( "YYYYMMDD-HH:MM:SS" )-1
 
static const unsigned int ValueSizeUTCTimeOnlyPico = sizeof( "HH:MM:SS.ssssssssssss" )-1
 
static const unsigned int ValueSizeUTCTimeOnlyNano = sizeof( "HH:MM:SS.sssssssss" )-1
 
static const unsigned int ValueSizeUTCTimeOnlyMicro = sizeof( "HH:MM:SS.ssssss" )-1
 
static const unsigned int ValueSizeUTCTimeOnlyMilli = sizeof( "HH:MM:SS.sss" )-1
 
static const unsigned int ValueSizeUTCTimeOnlySec = sizeof( "HH:MM:SS" )-1
 

Enumeration Type Documentation

Time flags for converts to string

Enumerator
Seconds 

Converts to string with seconds.

Milliseconds 

Converts to string with milliseconds.

Microseconds 

Converts to string with microseconds.

Nanoseconds 

Converts to string with nanoseconds.

Picoseconds 

Converts to string with picoseconds.

TrimTrailingZeros 

Trim zeros.

MillisecondsAndTrim 

Converts to string with milliseconds and trim zeros.

MicrosecondsAndTrim 

Converts to string with microseconds and trim zeros.

NanosecondsAndTrim 

Converts to string with nanoseconds and trim zeros.

PicosecondsAndTrim 

Converts to string with picoseconds and trim zeros.

Function Documentation

void B2bits::TZTimeHelper::nowTZDateOnly ( UTCDateOnly &  date)

Fills current date in UTCDateOnly in local time zone

Parameters
datestructure UTCDateOnly with date data
UTCDateOnly B2bits::TZTimeHelper::nowTZDateOnly ( )

Get current date with local time zone.

void B2bits::TZTimeHelper::nowTZTimeOnly ( TZTimeOnly &  time)

Fills current time in TZTimeOnly

Parameters
timestructure TZTimeOnly with time data
TZTimeOnly B2bits::TZTimeHelper::nowTZTimeOnly ( )

Get current time in local time zone.

void B2bits::TZTimeHelper::nowTZTimestamp ( TZTimestamp &  timestamp)

Fills current date and time in TZTimestamp

Parameters
timestampstructure TZTimeOnly with date and time in local time zone
TZTimestamp B2bits::TZTimeHelper::nowTZTimestamp ( )

Get current time and date in local time zone.

void B2bits::TZTimeHelper::nowUTCDateOnly ( UTCDateOnly &  date)

Fills current date in UTCDateOnly in UTC

Parameters
datestructure UTCDateOnly with date data
UTCDateOnly B2bits::TZTimeHelper::nowUTCDateOnly ( )

Get current date in UTC.

void B2bits::TZTimeHelper::nowUTCTimeOnly ( UTCTimeOnly &  time)

Fills current time in UTCTimeOnly

Parameters
timestructure UTCTimeOnly with time data
UTCTimeOnly B2bits::TZTimeHelper::nowUTCTimeOnly ( )

Get current time in UTC.

void B2bits::TZTimeHelper::nowUTCTimestamp ( UTCTimestamp &  timestamp)

Fills current date and time in TZTimestamp

Parameters
timestampstructure TZTimeOnly with date and time in UTC
UTCTimestamp B2bits::TZTimeHelper::nowUTCTimestamp ( )

Get current date and time in UTC.

bool B2bits::TZTimeHelper::parseDateOnly ( const char *  data,
size_t  lenght,
UTCDateOnly &  date 
)

Parses string UTCDateOnly - "YYYYMMDD" to UTCDateOnly structure

Parameters
dataMemory buffer with string
lenghtLenght of string in data
[out]datestructure UTCDateOnly with data parsing
Returns
success parsing
bool B2bits::TZTimeHelper::parseTimeOnly ( const char *  data,
size_t  lenght,
TZTimeOnly &  time 
)

Parses string UTCTimeOnly( "HH:MM:SS[.sss]" ) or TZTimeOnly( "HH:MM[:SS][.sss][Z | [ + | - hh[:mm]]]" ) to TZTimeOnly structure

Parameters
dataMemory buffer with string
lenghtLenght of string in data
[out]timestructure TZTimeOnly with data parsing
Returns
success parsing
bool B2bits::TZTimeHelper::parseTimestamp ( const char *  data,
size_t  lenght,
TZTimestamp &  timestamp 
)

Parses string UTCTimestamp( "YYYYMMDD-HH:MM:SS[.sss]" ) or TZTimestamp( "YYYYMMDD-HH:MM:SS[.sss][Z | [ + | - hh[:mm]]]" ) to TZTimestamp structure

Parameters
dataMemory buffer with string
lenghtLenght of string in data
timestampstructure TZTimestamp with data parsing
Returns
success parsing
bool B2bits::TZTimeHelper::parseUTCTimeOnly ( const char *  data,
size_t  lenght,
UTCTimeOnly &  time 
)

Parses string UTCTimeOnly - "HH:MM:SS[.sss]" to UTCTimeOnly structure

Parameters
dataMemory buffer with string
lenghtLenght of string in data
[out]timestructure UTCTimeOnly with data parsing
Returns
success parsing
bool B2bits::TZTimeHelper::parseUTCTimestamp ( const char *  data,
size_t  lenght,
UTCTimestamp &  timestamp 
)

Parses string UTCTimestamp - "YYYYMMDD-HH:MM:SS[.sss]" to UTCTimestamp structure

Parameters
dataMemory buffer with string
lenghtLenght of string in data
[out]timestampstructure UTCTimestamp with data parsing
Returns
success parsing
void B2bits::TZTimeHelper::timeSpecFromTZTimestamp ( struct timespec &  ts,
const TZTimestamp &  timestamp,
bool  convertToUTC = true 
)

Converts TZTimestamp to timespec

Parameters
[out]tsdestination timespec data
timestampsource TZTimestamp data
convertToUTCConvert or not in UTC
void B2bits::TZTimeHelper::timeSpecTFromUTCTimestamp ( struct timespec &  ts,
const UTCTimestamp &  timestamp 
)

Converts UTCTimestamp to timespec

Parameters
[out]tsdestination timespec data
timestampsource UTCTimestamp data
time_t B2bits::TZTimeHelper::timeTFromTZTimestamp ( const TZTimestamp &  timestamp,
bool  convertToUTC = true 
)

Converts TZTimestamp to time_t

Parameters
timestampsource TZTimestamp data
convertToUTCConvert or not in UTC
Returns
time_t data
time_t B2bits::TZTimeHelper::timeTFromUTCTimestamp ( const UTCTimestamp &  timestamp)

Converts UTCTimestamp to time_t

Returns
time_t data
size_t B2bits::TZTimeHelper::tzTimeOnlyToString ( char *  data,
size_t  lenght,
const TZTimeOnly &  time,
TimeFlags  flags = Milliseconds 
)

Converts to char buffer TZTimeOnly( "HH:MM[:SS][.sss][Z | [ + | - hh[:mm]]]" ) without terminating zero

Parameters
[out]dataMemory buffer
lenghtSize memory buffer ( use ValueSizeBufferTZTimeOnly or more )
timestructure TZTimeOnly with time data
flagsTime precision flags for conversion to string representation
Returns
Lenght string
void B2bits::TZTimeHelper::tzTimestampFromTimeSpec ( TZTimestamp &  timestamp,
const struct timespec &  ts,
i16  utcOffset = 0 
)

Converts timespec to TZTimestamp

Parameters
[out]timestampdestination TZTimestamp data
tssource timespec data
utcOffsetUTC Offset for TZTimestamp
void B2bits::TZTimeHelper::tzTimestampFromTimeT ( TZTimestamp &  timestamp,
time_t  time_utc,
i16  utcOffset = 0 
)

Converts time_t to UTCTimestamp

Parameters
[out]timestampdestination TZTimestamp data
time_utcsource time_t data in utc
utcOffsetUTC Offset for TZTimestamp
size_t B2bits::TZTimeHelper::tzTimestampToString ( char *  data,
size_t  lenght,
const TZTimestamp &  timestamp,
TimeFlags  flags 
)

Converts to char buffer TZTimestamp( "YYYYMMDD-HH:MM:SS[.sss][Z | [ + | - hh[:mm]]]" ) without terminating zero

Parameters
[out]dataMemory buffer
lenghtSize memory buffer ( use ValueSizeBufferTZTimestamp or more )
timestampstructure TZTimestamp with date and time
flagsTime precision flags for conversion to string representation
Returns
Lenght string
size_t B2bits::TZTimeHelper::utcDateOnlyToString ( char *  data,
size_t  lenght,
const UTCDateOnly  date 
)

Converts to char buffer UTCDateOnly( "YYYYMMDD" ) without terminating zero

Parameters
[out]dataMemory buffer
lenghtSize memory buffer ( use sizeBufferTZDateOnly or more )
datestructure UTCDateOnly with date data
Returns
Lenght string
size_t B2bits::TZTimeHelper::utcTimeOnlyToString ( char *  data,
size_t  lenght,
const UTCTimeOnly &  time,
TimeFlags  flags = Milliseconds 
)

Converts to char buffer UTCTimeOnly( "HH:MM:SS[.sss]" ) without terminating zero

Parameters
[out]dataMemory buffer
lenghtSize memory buffer ( use ValueSizeBufferUTCTimeOnly or more )
timestructure UTCTimeOnly with time data
flagsTime precision flags for conversion to string representation
Returns
Lenght string
void B2bits::TZTimeHelper::utcTimestampFromTimeSpec ( UTCTimestamp &  timestamp,
const struct timespec &  ts 
)

Converts timespec to UTCTimestamp

Parameters
[out]timestampdestination UTCTimestamp data
tssource timespec data
void B2bits::TZTimeHelper::utcTimestampFromTimeT ( UTCTimestamp &  timestamp,
time_t  time_utc 
)

Converts time_t to UTCTimestamp

Parameters
[out]timestampdestination UTCTimestamp data
time_utcsource time_t data in utc
void B2bits::TZTimeHelper::utcTimestampFromTZTimestamp ( UTCTimestamp &  utcTimestamp,
const TZTimestamp &  tzTimestamp 
)

Converts TZTimestamp to UTCTimestamp

Parameters
[out]utcTimestampdestination UTCTimestamp data
tzTimestampsource TZTimestamp data
size_t B2bits::TZTimeHelper::utcTimestampToString ( char *  data,
size_t  lenght,
const UTCTimestamp &  timestamp,
TimeFlags  flags = Milliseconds 
)

Converts to string UTCTimestamp( "YYYYMMDD-HH:MM:SS[.sss]" ) without terminating zero

Parameters
[out]dataMemory buffer
lenghtSize memory buffer ( use ValueSizeBufferUTCTimestamp or more )
timestampstructure UTCTimestamp with date and time
flagsTime precision flags for conversion to string representation
Returns
Lenght string

Variable Documentation

const unsigned int B2bits::TZTimeHelper::ValueSizeBufferTZTimeOnly = sizeof( "HH:MM:SS.ssssssssssss+OO:OO" )-1
static

Minimum size buffer for convert to format TZTimeOnly

const unsigned int B2bits::TZTimeHelper::ValueSizeBufferTZTimestamp = sizeof( "YYYYMMDD-HH:MM:SS.ssssssssssss+OO:OO" )-1
static

Minimum size buffer for convert to format TZTimestamp

const unsigned int B2bits::TZTimeHelper::ValueSizeBufferUTCDateOnly = sizeof( "YYYYMMDD" )-1
static

Minimum size buffer for convert to format UTCDateOnly

const unsigned int B2bits::TZTimeHelper::ValueSizeBufferUTCTimeOnly = sizeof( "HH:MM:SS.ssssssssssss" )-1
static

Minimum size buffer for convert to format UTCTimeOnly

const unsigned int B2bits::TZTimeHelper::ValueSizeBufferUTCTimestamp = sizeof( "YYYYMMDD-HH:MM:SS.ssssssssssss" )-1
static

Minimum size buffer for convert to format UTCTimestamp

const unsigned int B2bits::TZTimeHelper::ValueSizeUTCTimeOnlyMicro = sizeof( "HH:MM:SS.ssssss" )-1
static

Lenght of string format UTCTimeOnly with microsecond

const unsigned int B2bits::TZTimeHelper::ValueSizeUTCTimeOnlyMilli = sizeof( "HH:MM:SS.sss" )-1
static

Lenght of string format UTCTimeOnly with millisecond

const unsigned int B2bits::TZTimeHelper::ValueSizeUTCTimeOnlyNano = sizeof( "HH:MM:SS.sssssssss" )-1
static

Lenght of string format UTCTimeOnly with nanosecond

const unsigned int B2bits::TZTimeHelper::ValueSizeUTCTimeOnlyPico = sizeof( "HH:MM:SS.ssssssssssss" )-1
static

Lenght of string format UTCTimeOnly with picosecond

const unsigned int B2bits::TZTimeHelper::ValueSizeUTCTimeOnlySec = sizeof( "HH:MM:SS" )-1
static

Lenght of string format UTCTimeOnly with second

const unsigned int B2bits::TZTimeHelper::ValueSizeUTCTimestampMicro = sizeof( "YYYYMMDD-HH:MM:SS.ssssss" )-1
static

Lenght of string format UTCTimestamp with microsecond

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

Lenght of string format UTCTimestamp with millisecond

const unsigned int B2bits::TZTimeHelper::ValueSizeUTCTimestampNano = sizeof( "YYYYMMDD-HH:MM:SS.sssssssss" )-1
static

Lenght of string format UTCTimestamp with nanosecond

const unsigned int B2bits::TZTimeHelper::ValueSizeUTCTimestampPico = sizeof( "YYYYMMDD-HH:MM:SS.ssssssssssss" )-1
static

Lenght of string format UTCTimestamp with picosecond

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

Lenght of string format UTCTimestamp with second