B2BITS FIX Antenna HFT  1.0.13
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Static Public Member Functions | List of all members
System::Time Class Reference

Time-related functions. More...

#include <FE_SYS_Time.h>

Public Types

typedef u64 AbsoluteLocalTime
 Absolute local time. More...
 
typedef u64 AbsoluteSystemTime
 Absolute system time (UTC) in milliseconds. More...
 
typedef u64 AbsoluteSystemTimeUsec1970
 Absolute system time (UTC) in microseconds. More...
 
typedef u64 RelativeTime
 Relative time. More...
 

Static Public Member Functions

static AbsoluteSystemTime afterMidnightLocalTime ()
 Returns the todays time in milliseconds (after midnight). More...
 
static AbsoluteLocalTime currentLocalTime ()
 Returns the current local time in milliseconds. More...
 
static AbsoluteSystemTime currentTime ()
 Returns the current UTC time in milliseconds. More...
 
static AbsoluteSystemTimeUsec1970 currentTimeUsec1970 ()
 Returns the current UTC time in microseconds. More...
 
static u64 deltaUsec (RelativeTime t2, RelativeTime t1)
 Calculates delta in microseconds between two time values. More...
 
static AbsoluteSystemTime fromTimespec (timespec v)
 Converts from the struct timespec (containing the time interval since UNIX epoch like time_t) to the internal format. More...
 
static AbsoluteSystemTime fromTimeT (time_t v)
 Converts from the unix timestamp to the internal format. More...
 
static AbsoluteSystemTime fromTimeval (timeval v)
 Converts from the struct timeval (containing the time interval since UNIX epoch like time_t) to the internal format. More...
 
static AbsoluteSystemTime fromWindowsFileTime (u64 v)
 Converts from the Windows FileTime to the internal format. More...
 
static RelativeTime getMonotonicTime ()
 Returns number of milliseconds steadily. More...
 
static const std::string getUTCTimestamp ()
 Returns the current UTC time std::string in the "YYYYMMDD-HH:MM:SS" format. More...
 
static void getUTCTimestamp (char *out)
 Returns the current UTC time std::string in the "YYYYMMDD-HH:MM:SS" format. More...
 
static const std::string getUTCTimestampWithMicroseconds ()
 Returns the current UTC time std::string in the "YYYYMMDD-HH:MM:SS.ssssss" format. More...
 
static const std::string getUTCTimestampWithMs ()
 Returns the current UTC time std::string in the "YYYYMMDD-HH:MM:SS.sss" format. More...
 
static void getUTCTimestampWithMs (char *out)
 Returns the current UTC time std::string in the "YYYYMMDD-HH:MM:SS.sss" format. More...
 
static const std::string & getUTCTimestampWithMs_TLS ()
 Returns the current UTC time in the "YYYYMMDD-HH:MM:SS.sss" format. More...
 
static void getUTCTimestampWithMsNoZeroTerm (char *out)
 Returns the current UTC time std::string in the "YYYYMMDD-HH:MM:SS.sss" format. More...
 
static AbsoluteSystemTime pastMidnightTime ()
 Returns the past midnight time in milliseconds (UTC). More...
 
static u64 string2time (const std::string &str)
 Returns the time value in milliseconds of the given std::string in the "YYYYMMDD-HH:MM:SS.sss" or "YYYYMMDD-HH:MM:SS" format. More...
 
static u64 time2ms (const std::string &time)
 Converts time to millisconds. More...
 
static const std::string time2string (AbsoluteSystemTime timeValue, bool includeMilliseconds=true)
 Returns the std::string representation of the given time value. More...
 
static void time2string (char *dest, u64 timeValue, bool includeMilliseconds=true)
 Returns the std::string representation of the given time value. More...
 
static const std::string time2string1970 (AbsoluteSystemTimeUsec1970 timeValue)
 Returns string representation of the given time value. More...
 
static void time2string1970 (char *dest, AbsoluteSystemTimeUsec1970 timeValue, bool includeMilliseconds=true, bool includeMicroseconds=true)
 Returns string representation of the given time value. More...
 
static u64 timeToDecimal (AbsoluteSystemTime timeValue, bool withMs=true) throw ()
 Converts UTC time to decimal format YYYYMMDDHHmmsszzz. More...
 
static timespec * toTimespec (timespec *dest, AbsoluteSystemTime src)
 Converts the internal time value as the time interval since UNIX epoch to the struct timespec format. More...
 
static time_t toTimeT (AbsoluteSystemTime v)
 Converts the internal time value to the unix timestamp format. More...
 
static timeval * toTimeval (timeval *dest, AbsoluteSystemTime src)
 Converts the internal time value as the time interval since UNIX epoch to the struct timeval format. More...
 
static u64 toWindowsFileTime (AbsoluteSystemTime v)
 Converts internal time value to the Windows FileTime format. More...
 

Detailed Description

Time-related functions.

Member Typedef Documentation

Absolute local time.

Absolute system time (UTC) in milliseconds.

Absolute system time (UTC) in microseconds.

Relative time.

Member Function Documentation

static AbsoluteSystemTime System::Time::afterMidnightLocalTime ( )
static

Returns the todays time in milliseconds (after midnight).

Exceptions
SystemException.
static AbsoluteLocalTime System::Time::currentLocalTime ( )
static

Returns the current local time in milliseconds.

Exceptions
SystemException.

Referenced by now_file().

static AbsoluteSystemTime System::Time::currentTime ( )
static

Returns the current UTC time in milliseconds.

Exceptions
SystemException.
static AbsoluteSystemTimeUsec1970 System::Time::currentTimeUsec1970 ( )
static

Returns the current UTC time in microseconds.

Exceptions
SystemException.

Referenced by NanosTimeConvertRecalib::calcDiff1(), get_currentTimeUsec1970(), and Engine::GlobalMsgIdGen::GlobalMsgIdGen().

static u64 System::Time::deltaUsec ( RelativeTime  t2,
RelativeTime  t1 
)
static

Calculates delta in microseconds between two time values.

Time::AbsoluteSystemTime System::Time::fromTimespec ( timespec  v)
inlinestatic

Converts from the struct timespec (containing the time interval since UNIX epoch like time_t) to the internal format.

Time::AbsoluteSystemTime System::Time::fromTimeT ( time_t  v)
inlinestatic

Converts from the unix timestamp to the internal format.

Time::AbsoluteSystemTime System::Time::fromTimeval ( timeval  v)
inlinestatic

Converts from the struct timeval (containing the time interval since UNIX epoch like time_t) to the internal format.

Time::AbsoluteSystemTime System::Time::fromWindowsFileTime ( u64  v)
inlinestatic

Converts from the Windows FileTime to the internal format.

Converts from Windows FileTime to interbal format.

References System::WIN_TIME_CORRECTOR.

static RelativeTime System::Time::getMonotonicTime ( )
static

Returns number of milliseconds steadily.

const std::string System::Time::getUTCTimestamp ( )
inlinestatic

Returns the current UTC time std::string in the "YYYYMMDD-HH:MM:SS" format.

Exceptions
SystemException.

References System::Time_UTCTimestampSize.

static void System::Time::getUTCTimestamp ( char *  out)
static

Returns the current UTC time std::string in the "YYYYMMDD-HH:MM:SS" format.

Parameters
outIs memory buffer of UTCTimestampSize bytes
Exceptions
SystemException.
static const std::string System::Time::getUTCTimestampWithMicroseconds ( )
static

Returns the current UTC time std::string in the "YYYYMMDD-HH:MM:SS.ssssss" format.

Exceptions
SystemException
const std::string System::Time::getUTCTimestampWithMs ( )
inlinestatic

Returns the current UTC time std::string in the "YYYYMMDD-HH:MM:SS.sss" format.

Exceptions
SystemException

References getUTCTimestampWithMsNoZeroTerm(), and System::Time_UTCTimestampMsNoZeroTermSize.

Referenced by Engine::LogFileT< FileT >::log().

void System::Time::getUTCTimestampWithMs ( char *  out)
inlinestatic

Returns the current UTC time std::string in the "YYYYMMDD-HH:MM:SS.sss" format.

Parameters
outIs memory buffer of UTCTimestampMsSize bytes

References getUTCTimestampWithMsNoZeroTerm(), and System::Time_UTCTimestampMsSize.

static const std::string& System::Time::getUTCTimestampWithMs_TLS ( )
static

Returns the current UTC time in the "YYYYMMDD-HH:MM:SS.sss" format.

Returns
reference to the std::string located in the thread local storage.
Exceptions
SystemException

Referenced by now(), and now_utc().

static void System::Time::getUTCTimestampWithMsNoZeroTerm ( char *  out)
static

Returns the current UTC time std::string in the "YYYYMMDD-HH:MM:SS.sss" format.

Parameters
outIs memory buffer of UTCTimestampMsSizeNoZeroTerm bytes

Referenced by getUTCTimestampWithMs().

static AbsoluteSystemTime System::Time::pastMidnightTime ( )
static

Returns the past midnight time in milliseconds (UTC).

Exceptions
SystemException.
static u64 System::Time::string2time ( const std::string &  str)
static

Returns the time value in milliseconds of the given std::string in the "YYYYMMDD-HH:MM:SS.sss" or "YYYYMMDD-HH:MM:SS" format.

Exceptions
SystemException
static u64 System::Time::time2ms ( const std::string &  time)
static

Converts time to millisconds.

Parameters
timestd::string representation of time (hh:mm or hh:mm:ss)
Exceptions
Utils::Exceptionwhen property cannot be extracted.
const std::string System::Time::time2string ( AbsoluteSystemTime  timeValue,
bool  includeMilliseconds = true 
)
inlinestatic

Returns the std::string representation of the given time value.

Parameters
includeMillisecondsIf true that the output format is "YYYYMMDD-HH:MM:SS.sss" format, otherwise - "YYYYMMDD-HH:MM:SS".
Exceptions
SystemException

References System::Time_UTCTimestampMsSize, and System::Time_UTCTimestampSize.

Referenced by now_file().

static void System::Time::time2string ( char *  dest,
u64  timeValue,
bool  includeMilliseconds = true 
)
static

Returns the std::string representation of the given time value.

Parameters
timeValueis either AbsoluteSystemTime or AbsoluteLocalTime
includeMillisecondsIf true that the output format is "YYYYMMDD-HH:MM:SS.sss" format, otherwise - "YYYYMMDD-HH:MM:SS".
Exceptions
SystemException
const std::string System::Time::time2string1970 ( AbsoluteSystemTimeUsec1970  timeValue)
inlinestatic

Returns string representation of the given time value.

Parameters
timeValueis microseconds since January 1, 1970 UTC
Exceptions
SystemException

References System::Time_UTCTimestampUsNoZeroTermSize.

Referenced by fix_algo::reorderSMHForMiax().

static void System::Time::time2string1970 ( char *  dest,
AbsoluteSystemTimeUsec1970  timeValue,
bool  includeMilliseconds = true,
bool  includeMicroseconds = true 
)
static

Returns string representation of the given time value.

Parameters
timeValueis microseconds since January 1, 1970 UTC
Exceptions
SystemException
static u64 System::Time::timeToDecimal ( AbsoluteSystemTime  timeValue,
bool  withMs = true 
)
throw (
)
static

Converts UTC time to decimal format YYYYMMDDHHmmsszzz.

timespec * System::Time::toTimespec ( timespec *  dest,
Time::AbsoluteSystemTime  src 
)
inlinestatic

Converts the internal time value as the time interval since UNIX epoch to the struct timespec format.

time_t System::Time::toTimeT ( Time::AbsoluteSystemTime  v)
inlinestatic

Converts the internal time value to the unix timestamp format.

static timeval* System::Time::toTimeval ( timeval *  dest,
AbsoluteSystemTime  src 
)
static

Converts the internal time value as the time interval since UNIX epoch to the struct timeval format.

u64 System::Time::toWindowsFileTime ( Time::AbsoluteSystemTime  v)
inlinestatic

Converts internal time value to the Windows FileTime format.

References System::WIN_TIME_CORRECTOR.