CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Typedefs | Functions | Variables
cond::time Namespace Reference

Typedefs

typedef
boost::date_time::subsecond_duration
< boost::posix_time::time_duration, 1000000000 > 
nanoseconds
 

Functions

Time_t from_boost (boost::posix_time::ptime bt)
 
Time_t from_timeval (::timeval stv)
 
unsigned int itsNanoseconds (boost::posix_time::time_duration const &td)
 
const Time_t kLowMask (0xFFFFFFFF)
 
Time_t now ()
 
cond::Time_t pack (cond::UnpackedTime iValue)
 
boost::posix_time::ptime to_boost (Time_t iValue)
 
inline::timeval to_timeval (Time_t iValue)
 
cond::UnpackedTime unpack (cond::Time_t iValue)
 

Variables

const boost::posix_time::ptime time0
 

Typedef Documentation

typedef boost::date_time::subsecond_duration<boost::posix_time::time_duration,1000000000> cond::time::nanoseconds

Definition at line 18 of file TimeConversions.h.

Function Documentation

Time_t cond::time::from_boost ( boost::posix_time::ptime  bt)
inline

Definition at line 52 of file TimeConversions.h.

References itsNanoseconds(), lumiQTWidget::t, and time0.

Referenced by SiStripDetVOffBuilder::getCondTime(), and FillInfoPopConSourceHandler::getNewObjects().

52  {
53  boost::posix_time::time_duration td = bt - time0;
54  Time_t t = td.total_seconds();
55  return (t << 32) + itsNanoseconds(td);
56 
57  }
const boost::posix_time::ptime time0
unsigned long long Time_t
Definition: Time.h:16
unsigned int itsNanoseconds(boost::posix_time::time_duration const &td)
Time_t cond::time::from_timeval ( ::timeval  stv)
inline

Definition at line 70 of file TimeConversions.h.

References lumiQTWidget::t.

Referenced by now().

70  {
71  Time_t t = stv.tv_sec;
72  return (t << 32) + 1000*stv.tv_usec;
73  }
unsigned long long Time_t
Definition: Time.h:16
unsigned int cond::time::itsNanoseconds ( boost::posix_time::time_duration const &  td)
inline

Definition at line 36 of file TimeConversions.h.

Referenced by from_boost().

36  {
37  return boost::posix_time::time_duration::num_fractional_digits() == 6 ?
38  1000*td.fractional_seconds() : td.fractional_seconds();
39  }
const Time_t cond::time::kLowMask ( 0xFFFFFFFF  )
Time_t cond::time::now ( )
inline

Definition at line 75 of file TimeConversions.h.

References from_timeval().

Referenced by cond::UpdateStamp::stamp().

75  {
76  ::timeval stv;
77  ::gettimeofday(&stv,0);
78  return from_timeval(stv);
79  }
Time_t from_timeval(::timeval stv)
cond::Time_t cond::time::pack ( cond::UnpackedTime  iValue)
inline

Definition at line 29 of file TimeConversions.h.

References lumiQTWidget::t.

Referenced by FillInfoPopConSourceHandler::getNewObjects(), and cond::IOVElementProxy::set().

29  {
30  Time_t t = iValue.first;
31  return (t<< 32) + iValue.second;
32  }
unsigned long long Time_t
Definition: Time.h:16
boost::posix_time::ptime cond::time::to_boost ( Time_t  iValue)
inline

Definition at line 45 of file TimeConversions.h.

References kLowMask(), seconds(), and time0.

Referenced by SiStripDetVOffBuilder::getCoralTime(), FillInfoPopConSourceHandler::getNewObjects(), FillInfo::print(), and popcon::SiStripDetVOffHandler::setUserTextLog().

45  {
46  return time0 +
47  boost::posix_time::seconds( iValue >> 32) +
48  nanoseconds(kLowMask & iValue);
49  }
double seconds()
const boost::posix_time::ptime time0
const Time_t kLowMask(0xFFFFFFFF)
boost::date_time::subsecond_duration< boost::posix_time::time_duration, 1000000000 > nanoseconds
inline ::timeval cond::time::to_timeval ( Time_t  iValue)

Definition at line 60 of file TimeConversions.h.

References kLowMask().

60  {
61  ::timeval stv;
62  // stv.tv_sec = static_cast<unsigned int>(iValue >> 32);
63  //stv.tv_usec = static_cast<unsigned int>(kLowMask & iValue);
64  stv.tv_sec = iValue >> 32;
65  stv.tv_usec = (kLowMask & iValue)/1000;
66  return stv;
67  }
const Time_t kLowMask(0xFFFFFFFF)
cond::UnpackedTime cond::time::unpack ( cond::Time_t  iValue)
inline

Definition at line 25 of file TimeConversions.h.

References kLowMask().

Referenced by FillInfoPopConSourceHandler::getNewObjects(), and cond::IOVElementProxy::set().

25  {
26  return cond::UnpackedTime(iValue >> 32, kLowMask & iValue);
27  }
const Time_t kLowMask(0xFFFFFFFF)
std::pair< unsigned int, unsigned int > UnpackedTime
Definition: Time.h:17

Variable Documentation

const boost::posix_time::ptime cond::time::time0
Initial value:
=
boost::posix_time::from_time_t(0)

Definition at line 42 of file TimeConversions.h.

Referenced by from_boost(), RunInfoRead::readData(), and to_boost().