CMS 3D CMS Logo

Typedefs | Functions | Variables
cond::time Namespace Reference

Typedefs

typedef boost::date_time::subsecond_duration< boost::posix_time::time_duration, 1000000000 > nanoseconds
 
typedef cond::Time_t Time_t
 
typedef cond::TimeType TimeType
 
typedef cond::UnpackedTime UnpackedTime
 

Functions

Time_t from_boost (boost::posix_time::ptime bt)
 
Time_t from_timeval (::timeval stv)
 
Time_t fromIOVSyncValue (edm::IOVSyncValue const &time, TimeType timetype)
 
unsigned int itsNanoseconds (boost::posix_time::time_duration const &td)
 
const Time_t kLowMask (0xFFFFFFFF)
 
edm::IOVSyncValue limitedIOVSyncValue (Time_t time, TimeType timetype)
 
edm::IOVSyncValue limitedIOVSyncValue (edm::IOVSyncValue const &time, TimeType timetype)
 
const Time_t MAX_VAL (std::numeric_limits< Time_t >::max())
 
const Time_t MIN_VAL (0)
 
Time_t now ()
 
cond::Time_t pack (cond::UnpackedTime iValue)
 
const unsigned int SECONDS_PER_LUMI (23)
 
Time_t sinceGroupSize (TimeType tp)
 
Time_t tillTimeFromNextSince (Time_t nextSince, TimeType timeType)
 
TimeType timeTypeFromName (const std::string &name)
 
std::string timeTypeName (TimeType type)
 
boost::posix_time::ptime to_boost (Time_t iValue)
 
inline::timeval to_timeval (Time_t iValue)
 
edm::IOVSyncValue toIOVSyncValue (cond::Time_t time, TimeType timetype, bool startOrStop)
 
cond::UnpackedTime unpack (cond::Time_t iValue)
 

Variables

static constexpr TimeType HASH =cond::hash
 
static constexpr TimeType INVALID =cond::invalid
 
static constexpr TimeType LUMIID =cond::lumiid
 
static constexpr const char *const MAX_TIMESTAMP = "9999-12-31 23:59:59.000"
 
static constexpr TimeType RUNNUMBER =cond::runnumber
 
static const std::pair< const char *, TimeTypes_timeTypeMap []
 
static constexpr unsigned int SINCE_HASH_GROUP_SIZE = SINCE_RUN_GROUP_SIZE
 
static constexpr unsigned int SINCE_LUMI_GROUP_SIZE = SINCE_RUN_GROUP_SIZE
 
static constexpr unsigned int SINCE_RUN_GROUP_SIZE = 1000
 
static constexpr unsigned long SINCE_TIME_GROUP_SIZE = 154618822656000
 
const boost::posix_time::ptime time0
 
static constexpr TimeType TIMESTAMP =cond::timestamp
 
static constexpr TimeType USERID =cond::userid
 

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.

Definition at line 18 of file Time.h.

Definition at line 30 of file Time.h.

Definition at line 28 of file Time.h.

Function Documentation

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

Definition at line 70 of file TimeConversions.h.

References protons_cff::t.

Referenced by now().

70  {
71  Time_t t = stv.tv_sec;
72  return (t << 32) + 1000*stv.tv_usec;
73  }
cond::Time_t Time_t
Definition: Time.h:18
Time_t cond::time::fromIOVSyncValue ( edm::IOVSyncValue const &  time,
TimeType  timetype 
)

Definition at line 81 of file Time.cc.

References edm::IOVSyncValue::eventID(), LUMIID, edm::IOVSyncValue::luminosityBlockNumber(), edm::EventID::run(), RUNNUMBER, edm::IOVSyncValue::time(), TIMESTAMP, edm::LuminosityBlockID::value(), and edm::Timestamp::value().

Referenced by CondDBESSource::setIntervalFor().

81  {
82  switch (timetype) {
83  case RUNNUMBER :
84  return time.eventID().run();
85  case LUMIID :
86  {
87  edm::LuminosityBlockID lum(time.eventID().run(), time.luminosityBlockNumber());
88  return lum.value();
89  }
90  case TIMESTAMP :
91  return time.time().value();
92  default:
93  return 0;
94  }
95  }
boost::uint64_t value() const
static constexpr TimeType RUNNUMBER
Definition: Time.h:34
static constexpr TimeType TIMESTAMP
Definition: Time.h:35
static constexpr TimeType LUMIID
Definition: Time.h:36
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  )
edm::IOVSyncValue cond::time::limitedIOVSyncValue ( Time_t  time,
TimeType  timetype 
)

Definition at line 98 of file Time.cc.

References edm::IOVSyncValue::invalidIOVSyncValue(), checklumidiff::l, LUMIID, edm::LuminosityBlockID::luminosityBlock(), edm::EventID::maxEventNumber(), edm::LuminosityBlockID::run(), RUNNUMBER, and TIMESTAMP.

Referenced by CondDBESSource::setIntervalFor().

98  {
99  switch (timetype) {
100  case RUNNUMBER :
101  // last lumi and event of this run
105  );
106  case LUMIID :
107  {
108  // the same lumiblock
110  return edm::IOVSyncValue(edm::EventID(l.run(),
111  l.luminosityBlock(),
113  );
114  }
115  case TIMESTAMP :
116  // next event ?
118  default:
120  }
121  }
static constexpr TimeType RUNNUMBER
Definition: Time.h:34
static constexpr TimeType TIMESTAMP
Definition: Time.h:35
static EventNumber_t maxEventNumber()
Definition: EventID.h:111
static const IOVSyncValue & invalidIOVSyncValue()
Definition: IOVSyncValue.cc:78
static constexpr TimeType LUMIID
Definition: Time.h:36
edm::IOVSyncValue cond::time::limitedIOVSyncValue ( edm::IOVSyncValue const &  time,
TimeType  timetype 
)

Definition at line 123 of file Time.cc.

References edm::IOVSyncValue::eventID(), edm::IOVSyncValue::invalidIOVSyncValue(), LUMIID, edm::IOVSyncValue::luminosityBlockNumber(), edm::EventID::maxEventNumber(), edm::EventID::run(), RUNNUMBER, and TIMESTAMP.

123  {
124  switch (timetype) {
125  case RUNNUMBER :
126  // last event of this run
127  return edm::IOVSyncValue(edm::EventID(time.eventID().run(),
130  );
131  case LUMIID :
132  // the same lumiblock
133  return edm::IOVSyncValue(edm::EventID(time.eventID().run(),
134  time.luminosityBlockNumber(),
136  );
137  case TIMESTAMP :
138  // same lumiblock
139  return edm::IOVSyncValue(edm::EventID(time.eventID().run(),
140  time.luminosityBlockNumber(),
142  );
143  default:
145  }
146  }
static constexpr TimeType RUNNUMBER
Definition: Time.h:34
static constexpr TimeType TIMESTAMP
Definition: Time.h:35
static EventNumber_t maxEventNumber()
Definition: EventID.h:111
static const IOVSyncValue & invalidIOVSyncValue()
Definition: IOVSyncValue.cc:78
static constexpr TimeType LUMIID
Definition: Time.h:36
const Time_t cond::time::MAX_VAL ( std::numeric_limits< Time_t ::max())
const Time_t cond::time::MIN_VAL ( )
Time_t cond::time::now ( )
inline

Definition at line 75 of file TimeConversions.h.

References from_timeval().

75  {
76  ::timeval stv;
77  ::gettimeofday(&stv,nullptr);
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 protons_cff::t.

Referenced by FillInfoPopConSourceHandler::getNewObjects(), and tillTimeFromNextSince().

29  {
30  Time_t t = iValue.first;
31  return (t<< 32) + iValue.second;
32  }
cond::Time_t Time_t
Definition: Time.h:18
const unsigned int cond::time::SECONDS_PER_LUMI ( 23  )
Time_t cond::time::sinceGroupSize ( TimeType  tp)

Definition at line 51 of file Time.cc.

References HASH, LUMIID, SINCE_HASH_GROUP_SIZE, SINCE_LUMI_GROUP_SIZE, SINCE_RUN_GROUP_SIZE, SINCE_TIME_GROUP_SIZE, and TIMESTAMP.

Referenced by cond::persistency::IOVProxy::load().

51  {
52  if( tp == TIMESTAMP ) return SINCE_TIME_GROUP_SIZE;
53  if( tp == LUMIID ) return SINCE_LUMI_GROUP_SIZE;
54  if( tp == HASH ) return SINCE_HASH_GROUP_SIZE;
55  return SINCE_RUN_GROUP_SIZE;
56  }
static constexpr unsigned long SINCE_TIME_GROUP_SIZE
Definition: Time.h:47
static constexpr TimeType TIMESTAMP
Definition: Time.h:35
static constexpr unsigned int SINCE_LUMI_GROUP_SIZE
Definition: Time.h:48
static constexpr unsigned int SINCE_HASH_GROUP_SIZE
Definition: Time.h:49
static constexpr TimeType HASH
Definition: Time.h:37
static constexpr unsigned int SINCE_RUN_GROUP_SIZE
Definition: Time.h:45
static constexpr TimeType LUMIID
Definition: Time.h:36
Time_t cond::time::tillTimeFromNextSince ( Time_t  nextSince,
TimeType  timeType 
)

Definition at line 33 of file Time.cc.

References createfilelist::int, pack(), TIMESTAMP, and unpack().

Referenced by cond::persistency::IOVProxy::Iterator::operator*().

33  {
34  if( timeType != (TimeType)TIMESTAMP ){
35  return nextSince - 1;
36  } else {
37  UnpackedTime unpackedTime = unpack( nextSince );
38  //number of seconds in nanoseconds (avoid multiply and divide by 1e09)
39  Time_t totalSecondsInNanoseconds = ((Time_t)unpackedTime.first)*1000000000;
40  //total number of nanoseconds
41  Time_t totalNanoseconds = totalSecondsInNanoseconds + ((Time_t)(unpackedTime.second));
42  //now decrementing of 1 nanosecond
43  totalNanoseconds--;
44  //now repacking (just change the value of the previous pair)
45  unpackedTime.first = (unsigned int) (totalNanoseconds/1000000000);
46  unpackedTime.second = (unsigned int)(totalNanoseconds - (Time_t)unpackedTime.first*1000000000);
47  return pack(unpackedTime);
48  }
49  }
def pack(high, low)
TimeType
Definition: Time.h:21
static constexpr TimeType TIMESTAMP
Definition: Time.h:35
cond::Time_t Time_t
Definition: Time.h:18
cond::UnpackedTime UnpackedTime
Definition: Time.h:28
TimeType cond::time::timeTypeFromName ( const std::string &  name)

Definition at line 24 of file Time.cc.

References cond::findSpecs(), mps_fire::i, and cond::TimeTypeSpecs::type.

Referenced by cond::service::PoolDBOutputService::fillRecord(), cond::persistency::GetFromRow< cond::TimeType >::operator()(), and cond::service::PoolDBOutputService::PoolDBOutputService().

24  {
25  for (auto const &i : s_timeTypeMap)
26  if (name == i.first)
27  return i.second;
28  const cond::TimeTypeSpecs & theSpec = cond::findSpecs( name );
29  return theSpec.type;
30  //throwException( "TimeType \""+name+"\" is unknown.","timeTypeFromName");
31  }
static const std::pair< const char *, TimeType > s_timeTypeMap[]
Definition: Time.cc:14
TimeType type
Definition: Time.h:41
const TimeTypeSpecs & findSpecs(std::string const &name)
Definition: Time.cc:33
std::string cond::time::timeTypeName ( TimeType  type)

Definition at line 19 of file Time.cc.

Referenced by cond::persistency::f_add_attribute().

19  {
20  if( type==invalid ) return "";
21  return s_timeTypeMap[type].first;
22  }
type
Definition: HCALResponse.h:21
static const std::pair< const char *, TimeType > s_timeTypeMap[]
Definition: Time.cc:14
boost::posix_time::ptime cond::time::to_boost ( Time_t  iValue)
inline
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)
edm::IOVSyncValue cond::time::toIOVSyncValue ( cond::Time_t  time,
TimeType  timetype,
bool  startOrStop 
)

Definition at line 59 of file Time.cc.

References edm::IOVSyncValue::invalidIOVSyncValue(), checklumidiff::l, LUMIID, edm::LuminosityBlockID::luminosityBlock(), edm::EventID::maxEventNumber(), edm::LuminosityBlockID::run(), RUNNUMBER, and TIMESTAMP.

Referenced by CondDBESSource::setIntervalFor().

59  {
60  switch (timetype) {
61  case RUNNUMBER :
63  startOrStop ? 0 : edm::EventID::maxEventNumber(),
64  startOrStop ? 0 : edm::EventID::maxEventNumber())
65  );
66  case LUMIID :
67  {
69  return edm::IOVSyncValue(edm::EventID(l.run(),
70  l.luminosityBlock(),
71  startOrStop ? 0 : edm::EventID::maxEventNumber())
72  );
73  }
74  case TIMESTAMP :
76  default:
78  }
79  }
static constexpr TimeType RUNNUMBER
Definition: Time.h:34
static constexpr TimeType TIMESTAMP
Definition: Time.h:35
static EventNumber_t maxEventNumber()
Definition: EventID.h:111
static const IOVSyncValue & invalidIOVSyncValue()
Definition: IOVSyncValue.cc:78
static constexpr TimeType LUMIID
Definition: Time.h:36
cond::UnpackedTime cond::time::unpack ( cond::Time_t  iValue)
inline

Definition at line 25 of file TimeConversions.h.

References kLowMask().

Referenced by SiStripDetVOffTrendPlotter::analyze(), FillInfoPopConSourceHandler::getNewObjects(), and tillTimeFromNextSince().

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

constexpr TimeType cond::time::HASH =cond::hash
static

Definition at line 37 of file Time.h.

Referenced by sinceGroupSize().

constexpr TimeType cond::time::INVALID =cond::invalid
static

Definition at line 33 of file Time.h.

Referenced by CSCGEMMotherboard::findQualityGEM().

constexpr TimeType cond::time::LUMIID =cond::lumiid
static

Definition at line 36 of file Time.h.

Referenced by fromIOVSyncValue(), limitedIOVSyncValue(), sinceGroupSize(), and toIOVSyncValue().

constexpr const char* const cond::time::MAX_TIMESTAMP = "9999-12-31 23:59:59.000"
static

Definition at line 26 of file Time.h.

Referenced by CondDBESSource::CondDBESSource().

constexpr TimeType cond::time::RUNNUMBER =cond::runnumber
static

Definition at line 34 of file Time.h.

Referenced by fromIOVSyncValue(), limitedIOVSyncValue(), and toIOVSyncValue().

const std::pair<const char*, TimeType> cond::time::s_timeTypeMap[]
static
Initial value:
= { std::make_pair("Run", cond::runnumber),
std::make_pair("Time", cond::timestamp ),
std::make_pair("Lumi", cond::lumiid ),
std::make_pair("Hash", cond::hash ),
std::make_pair("User", cond::userid ) }

Definition at line 14 of file Time.cc.

constexpr unsigned int cond::time::SINCE_HASH_GROUP_SIZE = SINCE_RUN_GROUP_SIZE
static

Definition at line 49 of file Time.h.

Referenced by sinceGroupSize().

constexpr unsigned int cond::time::SINCE_LUMI_GROUP_SIZE = SINCE_RUN_GROUP_SIZE
static

Definition at line 48 of file Time.h.

Referenced by sinceGroupSize().

constexpr unsigned int cond::time::SINCE_RUN_GROUP_SIZE = 1000
static

Definition at line 45 of file Time.h.

Referenced by sinceGroupSize().

constexpr unsigned long cond::time::SINCE_TIME_GROUP_SIZE = 154618822656000
static

Definition at line 47 of file Time.h.

Referenced by sinceGroupSize().

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(), and RunInfoRead::readData().

constexpr TimeType cond::time::TIMESTAMP =cond::timestamp
static
constexpr TimeType cond::time::USERID =cond::userid
static

Definition at line 38 of file Time.h.