1 #ifndef CondCommon_TimeConversions_h
2 #define CondCommon_TimeConversions_h
10 #include "boost/date_time/posix_time/posix_time.hpp"
18 typedef boost::date_time::subsecond_duration<boost::posix_time::time_duration,1000000000>
nanoseconds;
31 return (t<< 32) + iValue.second;
36 inline unsigned int itsNanoseconds(boost::posix_time::time_duration
const & td) {
37 return boost::posix_time::time_duration::num_fractional_digits() == 6 ?
38 1000*td.fractional_seconds() : td.fractional_seconds();
42 const boost::posix_time::ptime
time0 =
43 boost::posix_time::from_time_t(0);
53 boost::posix_time::time_duration td = bt -
time0;
64 stv.tv_sec = iValue >> 32;
65 stv.tv_usec = (
kLowMask & iValue)/1000;
72 return (t << 32) + 1000*stv.tv_usec;
77 ::gettimeofday(&stv,0);
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::date_time::subsecond_duration< boost::posix_time::time_duration, 1000000000 > nanoseconds
boost::posix_time::ptime to_boost(Time_t iValue)
cond::UnpackedTime unpack(cond::Time_t iValue)