fix8
version 1.4.0
Open Source C++ FIX Framework
|
#include <tickval.hpp>
Public Types | |
using | f8_clock = std::chrono::high_resolution_clock |
using | f8_time_point = std::chrono::time_point< f8_clock > |
using | ticks = decltype(f8_time_point::min().time_since_epoch().count()) |
using | f8_duration = f8_time_point::duration |
Public Member Functions | |
Tickval (bool settonow=false) | |
Tickval (const Tickval &from) | |
Tickval (ticks from) | |
Tickval (f8_time_point from) | |
Tickval (time_t secs, long nsecs) | |
Tickval & | operator= (const Tickval &that) |
Tickval & | operator= (ticks that) |
ticks | get_ticks () const |
Tickval & | now () |
time_t | secs () const |
unsigned | msecs () const |
unsigned | usecs () const |
unsigned | nsecs () const |
double | todouble () const |
bool | is_errorval () const |
bool | in_range (const Tickval &a, const Tickval &b) const |
Tickval & | adjust (ticks by) |
struct tm * | as_tm (struct tm &result) const |
struct tm | get_tm () const |
void | set (time_t secs, long nsecs) |
bool | operator! () const |
operator void * () | |
operator Tickval::ticks () | |
operator double () | |
Static Public Member Functions | |
static const ticks & | errorticks () |
static Tickval | get_tickval () |
static Tickval & | get_tickval (Tickval &to) |
Static Public Attributes | |
static const ticks | noticks = 0 |
static const ticks | thousand = 1000 |
static const ticks | million = thousand * thousand |
static const ticks | billion = thousand * million |
static const ticks | second = billion |
static const ticks | minute = 60 * second |
static const ticks | hour = 60 * minute |
static const ticks | day = 24 * hour |
static const ticks | week = 7 * day |
Private Attributes | |
f8_time_point | _value |
Friends | |
Tickval | operator- (const Tickval &newtime, const Tickval &oldtime) |
Tickval & | operator-= (Tickval &oldtime, const Tickval &newtime) |
Tickval | operator+ (const Tickval &newtime, const Tickval &oldtime) |
Tickval & | operator+= (Tickval &oldtime, const Tickval &newtime) |
bool | operator== (const Tickval &a, const Tickval &b) |
bool | operator!= (const Tickval &a, const Tickval &b) |
bool | operator> (const Tickval &a, const Tickval &b) |
bool | operator< (const Tickval &a, const Tickval &b) |
bool | operator>= (const Tickval &a, const Tickval &b) |
bool | operator<= (const Tickval &a, const Tickval &b) |
Tickval & | operator+= (Tickval &oldtime, ticks ns) |
Tickval & | operator-= (Tickval &oldtime, ticks ns) |
std::ostream & | operator<< (std::ostream &os, const Tickval &what) |
std::ostream & | operator>> (std::ostream &os, const Tickval &what) |
High resolution time in nanosecond ticks. Thread safe. Portable, based on std::chrono Assumes we support nanosecond resolution. For implementations that don't, there will be inaccuracies: Windows 7 supports up to 15ms resolution only; for Windows 8 it is 100ns. Linux x86_64 is 1ns.
Definition at line 57 of file tickval.hpp.
using FIX8::Tickval::f8_clock = std::chrono::high_resolution_clock |
Definition at line 63 of file tickval.hpp.
using FIX8::Tickval::f8_duration = f8_time_point::duration |
Definition at line 67 of file tickval.hpp.
using FIX8::Tickval::f8_time_point = std::chrono::time_point<f8_clock> |
Definition at line 65 of file tickval.hpp.
using FIX8::Tickval::ticks = decltype(f8_time_point::min().time_since_epoch().count()) |
Definition at line 66 of file tickval.hpp.
|
inlineexplicit |
Ctor.
settonow | if true, construct with current time |
Definition at line 90 of file tickval.hpp.
Referenced by get_tickval(), and set().
|
inline |
|
inlineexplicit |
Ctor.
from | construct from raw ticks value (nanoseconds) |
Definition at line 98 of file tickval.hpp.
|
inlineexplicit |
|
inline |
Ctor.
secs | seconds |
nsecs | nanoseconds |
Definition at line 107 of file tickval.hpp.
Adjust Tickval by given value
by | amount to adjust; if +ve add, if -ve sub |
Definition at line 187 of file tickval.hpp.
Referenced by FIX8::Schedule::test().
|
inline |
Get tickval as struct tm
result | ref to struct tm to fill |
Definition at line 200 of file tickval.hpp.
Referenced by get_tm().
|
inlinestatic |
Definition at line 69 of file tickval.hpp.
Referenced by FIX8::Configuration::get_time_field(), and is_errorval().
|
inline |
Get the raw tick value (nanosecs).
Definition at line 129 of file tickval.hpp.
Referenced by FIX8::Configuration::create_schedule(), FIX8::date_parse(), FIX8::date_time_parse(), is_errorval(), FIX8::Timer< T >::operator()(), FIX8::Schedule::test(), and FIX8::time_parse().
|
inlinestatic |
Generate a Tickval object, constructed with the current time.
Definition at line 191 of file tickval.hpp.
References Tickval().
Referenced by FIX8::Timer< T >::operator()(), and FIX8::Timer< T >::schedule().
Assign current time to a given Tickval object.
Definition at line 195 of file tickval.hpp.
References Tickval().
|
inline |
Get tickval as struct tm
Definition at line 213 of file tickval.hpp.
References as_tm().
Referenced by FIX8::date_time_format(), and FIX8::Schedule::test().
See if this Tickval is within the range given
a | lower boundary |
b | upper boundary; if an error value, ignore upper range |
Definition at line 179 of file tickval.hpp.
References is_errorval().
Referenced by FIX8::Schedule::test().
|
inline |
See if this Tickval holds an error value
Definition at line 173 of file tickval.hpp.
References errorticks(), and get_ticks().
Referenced by FIX8::Configuration::create_schedule(), in_range(), and FIX8::Schedule::is_valid().
|
inline |
Get the current number of elapsed milliseconds (excluding secs)
Definition at line 145 of file tickval.hpp.
Referenced by FIX8::date_time_format(), FIX8::Logger::process_logline(), and FIX8::XmlFileLogger::process_logline().
|
inline |
Assign the current time to this object.
Definition at line 133 of file tickval.hpp.
Referenced by FIX8::GetTimeAsStringMini(), FIX8::GetTimeAsStringMS(), FIX8::Session::heartbeat_service(), FIX8::IntervalTimer::Reset(), FIX8::Session::send_process(), FIX8::Session::update_received(), and FIX8::Session::update_sent().
|
inline |
Get the current number of elapsed nanoseconds (excluding secs)
Definition at line 159 of file tickval.hpp.
Referenced by FIX8::GetTimeAsStringMS().
|
inline |
Cast to double.
Definition at line 238 of file tickval.hpp.
References todouble().
|
inline |
Cast to unsigned long long.
Definition at line 234 of file tickval.hpp.
|
inline |
|
inline |
Assignment operator from ticks
that | ticks to assign from |
Definition at line 121 of file tickval.hpp.
|
inline |
Get the current number of elapsed seconds
Definition at line 141 of file tickval.hpp.
Referenced by FIX8::GetTimeAsStringMini(), FIX8::GetTimeAsStringMS(), FIX8::Session::heartbeat_service(), FIX8::Logger::process_logline(), and FIX8::XmlFileLogger::process_logline().
|
inline |
Set from secs/nsecs
secs | seconds |
nsecs | nanoseconds |
Definition at line 222 of file tickval.hpp.
References Tickval().
|
inline |
Get the current tickval as a double.
Definition at line 166 of file tickval.hpp.
Referenced by FIX8::IntervalTimer::AsDouble(), and operator double().
|
inline |
Get the current number of elapsed microseconds (excluding secs)
Definition at line 152 of file tickval.hpp.
Binary addition operator.
oldtime | Tickval to add to |
ns | ticks to add |
Definition at line 314 of file tickval.hpp.
|
friend |
ostream inserter friend; Tickval printer, localtime
os | stream to insert into |
what | Tickval to insert |
Definition at line 334 of file tickval.hpp.
Less than or equal to operator.
Definition at line 308 of file tickval.hpp.
Greater than operator.
Definition at line 290 of file tickval.hpp.
Greater than or equal to operator.
Definition at line 302 of file tickval.hpp.
|
friend |
ostream inserter friend; Tickval printer, gmtime
os | stream to insert into |
what | Tickval to insert |
Definition at line 344 of file tickval.hpp.
|
private |
Definition at line 85 of file tickval.hpp.
Referenced by operator=().
Definition at line 77 of file tickval.hpp.
Referenced by FIX8::date_parse(), FIX8::date_time_parse(), and FIX8::time_parse().
Definition at line 81 of file tickval.hpp.
Referenced by FIX8::Schedule::test().
Definition at line 80 of file tickval.hpp.
Definition at line 76 of file tickval.hpp.
Referenced by FIX8::date_time_parse(), FIX8::Timer< T >::operator()(), FIX8::Timer< T >::schedule(), and FIX8::time_parse().
Definition at line 79 of file tickval.hpp.
Referenced by FIX8::Configuration::create_schedule().
|
static |
Definition at line 68 of file tickval.hpp.
Referenced by FIX8::date_time_parse(), and FIX8::time_parse().
Definition at line 78 of file tickval.hpp.
|
static |
Definition at line 75 of file tickval.hpp.
Definition at line 82 of file tickval.hpp.