3
#include <boost/version.hpp>
4
#include <boost/thread/xtime.hpp>
8
// Boost WTF time format, directly from C...
9
boost::xtime& operator+=(boost::xtime& time, double seconds) {
10
double nsec = 1e9 * (time.sec + seconds) + time.nsec;
11
time.sec = boost::xtime::xtime_sec_t(nsec / 1e9);
12
time.nsec = boost::xtime::xtime_nsec_t(std::fmod(nsec, 1e9));
15
boost::xtime operator+(boost::xtime const& left, double seconds) {
16
boost::xtime time = left;
17
return time += seconds;
19
double operator-(boost::xtime const& a, boost::xtime const& b) {
20
return a.sec - b.sec + 1e-9 * (a.nsec - b.nsec);
24
#if (BOOST_VERSION / 100 % 1000 >= 50)
25
boost::xtime_get(&time, boost::TIME_UTC_);
27
boost::xtime_get(&time, boost::TIME_UTC);
31
double seconds(boost::xtime const& time) {
32
return time.sec + time.nsec * 1e-9;