JayBeams  0.1
Another project to have fun coding.
seconds_field.cpp
Go to the documentation of this file.
2 
3 #include <iomanip>
4 #include <sstream>
5 #include <stdexcept>
6 
7 template <>
9  auto full_day = std::chrono::seconds(24 * 3600);
10 
11  if (t.seconds() < full_day) {
12  return;
13  }
14  std::ostringstream os;
15  os << "out of range seconds_field <" << t.seconds().count()
16  << "> expected value in [0," << full_day.count() << ") range";
17  throw std::range_error(os.str());
18 }
19 
20 std::ostream& jb::itch5::operator<<(std::ostream& os, seconds_field const& x) {
21  auto t = x.int_seconds();
22 
23  auto ss = t % 60;
24  t /= 60;
25  auto mm = t % 60;
26  t /= 60;
27  auto hh = t;
28  return os << std::setw(2) << std::setfill('0') << hh << ':' << std::setw(2)
29  << std::setfill('0') << mm << ':' << std::setw(2)
30  << std::setfill('0') << ss;
31 }
Represent a ITCH-5.0 seconds_field.
void check_seconds_field_range< true >(seconds_field const &t)
Provide an active implementation of jb::itch5::check_seconds_field_range<>
std::ostream & operator<<(std::ostream &os, add_order_message const &x)
Streaming operator for jb::itch5::add_order_message.