1 #ifndef CondCommon_TimeConversions_h 2 #define CondCommon_TimeConversions_h 10 #include "boost/date_time/posix_time/posix_time.hpp" 16 typedef boost::date_time::subsecond_duration<boost::posix_time::time_duration, 1000000000>
nanoseconds;
28 return (
t << 32) + iValue.second;
32 inline unsigned int itsNanoseconds(boost::posix_time::time_duration
const& td) {
33 return boost::posix_time::time_duration::num_fractional_digits() == 6 ? 1000 * td.fractional_seconds()
34 : td.fractional_seconds();
37 const boost::posix_time::ptime
time0 = boost::posix_time::from_time_t(0);
44 boost::posix_time::time_duration td = bt -
time0;
53 stv.tv_sec = iValue >> 32;
54 stv.tv_usec = (
kLowMask & iValue) / 1000;
60 return (
t << 32) + 1000 * stv.tv_usec;
65 ::gettimeofday(&stv,
nullptr);
boost::date_time::subsecond_duration< boost::posix_time::time_duration, 1000000000 > nanoseconds
const boost::posix_time::ptime time0
const Time_t kLowMask(0xFFFFFFFF)
cond::Time_t pack(cond::UnpackedTime iValue)
unsigned long long Time_t
Time_t from_timeval(::timeval stv)
Time_t from_boost(boost::posix_time::ptime bt)
unsigned int itsNanoseconds(boost::posix_time::time_duration const &td)
inline ::timeval to_timeval(Time_t iValue)
std::pair< unsigned int, unsigned int > UnpackedTime
boost::posix_time::ptime to_boost(Time_t iValue)
cond::UnpackedTime unpack(cond::Time_t iValue)