21 #include <boost/regex.hpp>    31 #   define SENF_CLOCKTYPEVAL(clock) (clock).value()    33 #   define SENF_CLOCKTYPEVAL(clock) (clock)    39 parseClockServiceInterval__(std::string 
const & value)
    43     static boost::sregex_iterator::regex_type rx (
"[mun]?[dhms]");
    44     boost::sregex_iterator i (value.begin(), value.end(), rx);
    45     boost::sregex_iterator 
const i_end;
    46     std::string::const_iterator j (value.begin());
    47     for (; i != i_end; ++i) {
    48         boost::sregex_iterator::value_type::value_type match ((*i)[0]);
    49         T v (boost::lexical_cast<T>(std::string(j, match.first)));
    52         if (match.length() == 2) {
    54             unit = *boost::next(match.first);
    57                          "Internal failure: RegEx match returns weird number of matches" );
    64         case 's': v *= 1000000000;
    89         console::parse( *(arg++), value );
    93     if (value.find(
'.') != std::string::npos) {
    94         out = parseClockServiceInterval__<long double>(value);
    96         out = parseClockServiceInterval__<ClockService::int64_type>(value);
   104     boost::posix_time::time_duration 
delta (time - baseAbstime_);
   105     return baseClock_ + 
clock_type( delta.ticks() )
   106         * 
clock_type( 1000000000UL / boost::posix_time::time_duration::ticks_per_second() );
   115 #ifdef BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG   116     return baseAbstime_ + boost::posix_time::nanoseconds(
   119     return baseAbstime_ + boost::posix_time::microseconds(
   128     os << interval << 
"ns";
 config::time_type clock_type
ClockService timer data type. 
ClockService::clock_type const  & now()
Return (approximate) current time. 
#define SENF_CLOCKTYPEVAL(clock)
void formatClockServiceInterval(ClockService::clock_type interval, std::ostream &os)
std::int64_t int64_type
Supplementary integer type. 
#define SENF_ASSERT(x, comment)
boost::iterator_range< token_iterator > TokensRange
boost::posix_time::ptime abstime_type
Absolute time data type. 
ClockService public header. 
void parseClockServiceInterval(console::ParseCommandInfo::TokensRange const &tokens, ClockService::clock_type &out)
Console argument parser to parse value as time interval. 
static clock_type clock(abstime_type const &time)
Convert absolute time to clock value. 
static SENF_CLOCKSERVICE_CONSTEXPR clock_type nanoseconds(int64_type const &v)
Convert v nanoseconds to clock_type.