prefix_ senf::ClockService::clock_type senf::ClockService::clock_m(abstime_type time)
{
+ if (now() - baseClock_ > 1000000000ll)
+ restart_m();
boost::posix_time::time_duration delta (time - baseAbstime_);
return baseClock_ + clock_type( delta.ticks() )
* clock_type( 1000000000UL / boost::posix_time::time_duration::ticks_per_second() );
prefix_ senf::ClockService::abstime_type senf::ClockService::abstime_m(clock_type clock)
{
+ if (now() - baseClock_ > 1000000000ll)
+ restart_m();
#ifdef BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
return baseAbstime_ + boost::posix_time::nanoseconds(clock-baseClock_);
#else
return instance().abstime_m(clock);
}
+prefix_ senf::ClockService::reltime_type senf::ClockService::reltime(clock_type clock)
+{
+#ifdef BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
+ return boost::posix_time::nanoseconds(clock);
+#else
+ return boost::posix_time::microseconds((clock+500)/1000);
+#endif
+}
+
prefix_ senf::ClockService::clock_type senf::ClockService::clock(abstime_type time)
{
return instance().clock_m(time);