1 #ifndef jb_itch5_timestamp_hpp 2 #define jb_itch5_timestamp_hpp 18 std::chrono::nanoseconds
ts;
34 template <
bool val
idate>
46 template <
bool val
idate>
50 check_offset<validate>(
"timestamp",
size, offset, 6);
53 timestamp tmp{std::chrono::nanoseconds(hi << 32 | lo)};
54 check_timestamp_range<validate>(tmp);
61 template <
bool val
idate>
64 static void w(std::size_t
size,
void* buf, std::size_t offset,
timestamp x) {
65 check_offset<validate>(
"encoder<timestamp>",
size, offset, 6);
66 check_timestamp_range<validate>(x);
67 using std::chrono::duration_cast;
68 using std::chrono::nanoseconds;
69 std::uint64_t nanos = duration_cast<nanoseconds>(x.
ts).count();
70 std::uint16_t hi = nanos >> 32;
71 std::uint32_t lo = nanos & 0xFFFFFFFF;
83 #endif // jb_itch5_timestamp_hpp static timestamp r(std::size_t size, void const *buf, std::size_t offset)
Please see the generic documentation for jb::itch5::decoder<>::r()
static T r(std::size_t size, void const *msg, std::size_t offset)
Read a single message or field.
static void w(std::size_t size, void *msg, std::size_t offset, T const &x)
Write a single message or field to a buffer.
void check_timestamp_range< true >(timestamp const &t)
Provide an active implementation of jb::itch5::check_timestamp_range<>
TODO(#19) all this code should be replaced with Boost.Endian.
Define the interface to decode ITCH-5.0 messages and message fields.
Represent a ITCH-5.0 timestamp.
void check_timestamp_range(timestamp const &t)
Validate the a timestamp value.
std::chrono::nanoseconds ts
std::ostream & operator<<(std::ostream &os, add_order_message const &x)
Streaming operator for jb::itch5::add_order_message.
static void w(std::size_t size, void *buf, std::size_t offset, timestamp x)
Please see the generic documentation for jb::itch5::decoder<>::r()
The top-level namespace for the JayBeams library.