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 (edm::IOVSyncValue const &time, TimeType timetype)
 
edm::IOVSyncValue limitedIOVSyncValue (Time_t time, TimeType timetype)
 
Time_t lumiTime (unsigned int run, unsigned int lumiId)
 
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 = boost::posix_time::from_time_t(0)
 
static constexpr TimeType TIMESTAMP = cond::timestamp
 
static constexpr TimeType USERID = cond::userid
 

Typedef Documentation

◆ nanoseconds

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

Definition at line 16 of file TimeConversions.h.

◆ Time_t

Definition at line 18 of file Time.h.

◆ TimeType

Definition at line 30 of file Time.h.

◆ UnpackedTime

Definition at line 28 of file Time.h.

Function Documentation

◆ from_boost()

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

◆ from_timeval()

Time_t cond::time::from_timeval ( ::timeval  stv)
inline

Definition at line 58 of file TimeConversions.h.

58  {
59  Time_t t = stv.tv_sec;
60  return (t << 32) + 1000 * stv.tv_usec;
61  }

References submitPVValidationJobs::t.

Referenced by now().

◆ fromIOVSyncValue()

Time_t cond::time::fromIOVSyncValue ( edm::IOVSyncValue const &  time,
TimeType  timetype 
)

Definition at line 85 of file Time.cc.

85  {
86  switch (timetype) {
87  case RUNNUMBER:
88  return time.eventID().run();
89  case LUMIID: {
90  edm::LuminosityBlockID lum(time.eventID().run(), time.luminosityBlockNumber());
91  return lum.value();
92  }
93  case TIMESTAMP:
94  return time.time().value();
95  default:
96  return 0;
97  }
98  }

References LUMIID, RUNNUMBER, protons_cff::time, TIMESTAMP, DBConfiguration_cff::timetype, and edm::LuminosityBlockID::value().

Referenced by CondDBESSource::setIntervalFor().

◆ itsNanoseconds()

unsigned int cond::time::itsNanoseconds ( boost::posix_time::time_duration const &  td)
inline

Definition at line 32 of file TimeConversions.h.

32  {
33  return boost::posix_time::time_duration::num_fractional_digits() == 6 ? 1000 * td.fractional_seconds()
34  : td.fractional_seconds();
35  }

Referenced by from_boost().

◆ kLowMask()

const Time_t cond::time::kLowMask ( 0xFFFFFFFF  )

◆ limitedIOVSyncValue() [1/2]

edm::IOVSyncValue cond::time::limitedIOVSyncValue ( edm::IOVSyncValue const &  time,
TimeType  timetype 
)

Definition at line 119 of file Time.cc.

119  {
120  switch (timetype) {
121  case RUNNUMBER:
122  // last event of this run
123  return edm::IOVSyncValue(
125  case LUMIID:
126  // the same lumiblock
127  return edm::IOVSyncValue(
128  edm::EventID(time.eventID().run(), time.luminosityBlockNumber(), edm::EventID::maxEventNumber()));
129  case TIMESTAMP:
130  // same lumiblock
131  return edm::IOVSyncValue(
132  edm::EventID(time.eventID().run(), time.luminosityBlockNumber(), edm::EventID::maxEventNumber()));
133  default:
135  }
136  }

References edm::IOVSyncValue::invalidIOVSyncValue(), LUMIID, edm::EventID::maxEventNumber(), RUNNUMBER, protons_cff::time, TIMESTAMP, and DBConfiguration_cff::timetype.

◆ limitedIOVSyncValue() [2/2]

edm::IOVSyncValue cond::time::limitedIOVSyncValue ( Time_t  time,
TimeType  timetype 
)

Definition at line 101 of file Time.cc.

101  {
102  switch (timetype) {
103  case RUNNUMBER:
104  // last lumi and event of this run
106  case LUMIID: {
107  // the same lumiblock
109  return edm::IOVSyncValue(edm::EventID(l.run(), l.luminosityBlock(), edm::EventID::maxEventNumber()));
110  }
111  case TIMESTAMP:
112  // next event ?
114  default:
116  }
117  }

References edm::IOVSyncValue::invalidIOVSyncValue(), cmsLHEtoEOSManager::l, LUMIID, edm::EventID::maxEventNumber(), RUNNUMBER, protons_cff::time, TIMESTAMP, and DBConfiguration_cff::timetype.

Referenced by CondDBESSource::setIntervalFor().

◆ lumiTime()

Time_t cond::time::lumiTime ( unsigned int  run,
unsigned int  lumiId 
)

◆ MAX_VAL()

const Time_t cond::time::MAX_VAL ( std::numeric_limits< Time_t ::max())

◆ MIN_VAL()

const Time_t cond::time::MIN_VAL ( )

◆ now()

Time_t cond::time::now ( )
inline

Definition at line 63 of file TimeConversions.h.

63  {
64  ::timeval stv;
65  ::gettimeofday(&stv, nullptr);
66  return from_timeval(stv);
67  }

References from_timeval().

◆ pack()

cond::Time_t cond::time::pack ( cond::UnpackedTime  iValue)
inline

Definition at line 26 of file TimeConversions.h.

26  {
27  Time_t t = iValue.first;
28  return (t << 32) + iValue.second;
29  }

References submitPVValidationJobs::t.

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

◆ SECONDS_PER_LUMI()

const unsigned int cond::time::SECONDS_PER_LUMI ( 23  )

◆ sinceGroupSize()

Time_t cond::time::sinceGroupSize ( TimeType  tp)

Definition at line 56 of file Time.cc.

56  {
57  if (tp == TIMESTAMP)
58  return SINCE_TIME_GROUP_SIZE;
59  if (tp == LUMIID)
60  return SINCE_LUMI_GROUP_SIZE;
61  if (tp == HASH)
62  return SINCE_HASH_GROUP_SIZE;
63  return SINCE_RUN_GROUP_SIZE;
64  }

References HASH, LUMIID, SINCE_HASH_GROUP_SIZE, SINCE_LUMI_GROUP_SIZE, SINCE_RUN_GROUP_SIZE, SINCE_TIME_GROUP_SIZE, TIMESTAMP, and cmsswSequenceInfo::tp.

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

◆ tillTimeFromNextSince()

Time_t cond::time::tillTimeFromNextSince ( Time_t  nextSince,
TimeType  timeType 
)

Definition at line 34 of file Time.cc.

34  {
35  if (nextSince == time::MAX_VAL)
36  return time::MAX_VAL;
37  if (timeType != (TimeType)TIMESTAMP) {
38  return nextSince - 1;
39  } else {
40  UnpackedTime unpackedTime = unpack(nextSince);
41  //number of seconds in nanoseconds (avoid multiply and divide by 1e09)
42  Time_t totalSecondsInNanoseconds = ((Time_t)unpackedTime.first) * 1000000000;
43  //total number of nanoseconds
44  Time_t totalNanoseconds = totalSecondsInNanoseconds + ((Time_t)(unpackedTime.second));
45  //now decrementing of 1 nanosecond
46  totalNanoseconds--;
47  //now repacking (just change the value of the previous pair)
48  unpackedTime.first = (unsigned int)(totalNanoseconds / 1000000000);
49  unpackedTime.second = (unsigned int)(totalNanoseconds - (Time_t)unpackedTime.first * 1000000000);
50  return pack(unpackedTime);
51  }
52  }

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

Referenced by cond::persistency::IOVProxy::fetchSequence(), cond::persistency::IOVProxy::getInterval(), and cond::persistency::IOVArray::Iterator::operator*().

◆ timeTypeFromName()

TimeType cond::time::timeTypeFromName ( const std::string &  name)

Definition at line 25 of file Time.cc.

25  {
26  for (auto const& i : s_timeTypeMap)
27  if (name == i.first)
28  return i.second;
29  const cond::TimeTypeSpecs& theSpec = cond::findSpecs(name);
30  return theSpec.type;
31  //throwException( "TimeType \""+name+"\" is unknown.","timeTypeFromName");
32  }

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

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

◆ timeTypeName()

std::string cond::time::timeTypeName ( TimeType  type)

Definition at line 19 of file Time.cc.

19  {
20  if (type == invalid)
21  return "";
22  return s_timeTypeMap[type].first;
23  }

References s_timeTypeMap.

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

◆ to_boost()

boost::posix_time::ptime cond::time::to_boost ( Time_t  iValue)
inline

◆ to_timeval()

inline ::timeval cond::time::to_timeval ( Time_t  iValue)

Definition at line 49 of file TimeConversions.h.

49  {
50  ::timeval stv;
51  // stv.tv_sec = static_cast<unsigned int>(iValue >> 32);
52  //stv.tv_usec = static_cast<unsigned int>(kLowMask & iValue);
53  stv.tv_sec = iValue >> 32;
54  stv.tv_usec = (kLowMask & iValue) / 1000;
55  return stv;
56  }

References kLowMask().

◆ toIOVSyncValue()

edm::IOVSyncValue cond::time::toIOVSyncValue ( cond::Time_t  time,
TimeType  timetype,
bool  startOrStop 
)

Definition at line 67 of file Time.cc.

67  {
68  switch (timetype) {
69  case RUNNUMBER:
71  startOrStop ? 0 : edm::EventID::maxEventNumber(),
72  startOrStop ? 0 : edm::EventID::maxEventNumber()));
73  case LUMIID: {
75  return edm::IOVSyncValue(
76  edm::EventID(l.run(), l.luminosityBlock(), startOrStop ? 0 : edm::EventID::maxEventNumber()));
77  }
78  case TIMESTAMP:
80  default:
82  }
83  }

References edm::IOVSyncValue::invalidIOVSyncValue(), cmsLHEtoEOSManager::l, LUMIID, edm::EventID::maxEventNumber(), RUNNUMBER, protons_cff::time, TIMESTAMP, and DBConfiguration_cff::timetype.

Referenced by CondDBESSource::setIntervalFor().

◆ unpack()

cond::UnpackedTime cond::time::unpack ( cond::Time_t  iValue)
inline

Variable Documentation

◆ HASH

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

Definition at line 37 of file Time.h.

Referenced by sinceGroupSize().

◆ INVALID

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

Definition at line 33 of file Time.h.

Referenced by CSCGEMMotherboard::findQualityGEMv2().

◆ LUMIID

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

Definition at line 36 of file Time.h.

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

◆ MAX_TIMESTAMP

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

Definition at line 26 of file Time.h.

Referenced by CondDBESSource::CondDBESSource().

◆ RUNNUMBER

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

Definition at line 34 of file Time.h.

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

◆ s_timeTypeMap

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.

Referenced by timeTypeFromName(), and timeTypeName().

◆ SINCE_HASH_GROUP_SIZE

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

Definition at line 49 of file Time.h.

Referenced by sinceGroupSize().

◆ SINCE_LUMI_GROUP_SIZE

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

Definition at line 48 of file Time.h.

Referenced by sinceGroupSize().

◆ SINCE_RUN_GROUP_SIZE

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

Definition at line 45 of file Time.h.

Referenced by sinceGroupSize().

◆ SINCE_TIME_GROUP_SIZE

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

Definition at line 47 of file Time.h.

Referenced by sinceGroupSize().

◆ time0

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

◆ TIMESTAMP

constexpr TimeType cond::time::TIMESTAMP = cond::timestamp
staticconstexpr

◆ USERID

constexpr TimeType cond::time::USERID = cond::userid
staticconstexpr

Definition at line 38 of file Time.h.

cond::findSpecs
const TimeTypeSpecs & findSpecs(std::string const &name)
Definition: Time.cc:23
cond::time::UnpackedTime
cond::UnpackedTime UnpackedTime
Definition: Time.h:28
cond::time::Time_t
cond::Time_t Time_t
Definition: Time.h:18
cond::lumiid
Definition: Time.h:19
mps_fire.i
i
Definition: mps_fire.py:428
cond::TimeType
TimeType
Definition: Time.h:19
cond::time::nanoseconds
boost::date_time::subsecond_duration< boost::posix_time::time_duration, 1000000000 > nanoseconds
Definition: TimeConversions.h:16
cond::hash
Definition: Time.h:19
edm::IOVSyncValue::invalidIOVSyncValue
static const IOVSyncValue & invalidIOVSyncValue()
Definition: IOVSyncValue.cc:78
cond::time::from_timeval
Time_t from_timeval(::timeval stv)
Definition: TimeConversions.h:58
protons_cff.time
time
Definition: protons_cff.py:39
cond::time::itsNanoseconds
unsigned int itsNanoseconds(boost::posix_time::time_duration const &td)
Definition: TimeConversions.h:32
cond::time::SINCE_LUMI_GROUP_SIZE
static constexpr unsigned int SINCE_LUMI_GROUP_SIZE
Definition: Time.h:48
CTPPSpixelLocalTrackReconstructionInfo::invalid
cond::time::pack
cond::Time_t pack(cond::UnpackedTime iValue)
Definition: TimeConversions.h:26
cond::timestamp
Definition: Time.h:19
cond::userid
Definition: Time.h:19
seconds
double seconds()
cond::TimeTypeSpecs::type
TimeType type
Definition: Time.h:37
edm::LuminosityBlockID
Definition: LuminosityBlockID.h:31
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
edm::IOVSyncValue
Definition: IOVSyncValue.h:31
edm::EventID::maxEventNumber
static EventNumber_t maxEventNumber()
Definition: EventID.h:96
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
cond::time::kLowMask
const Time_t kLowMask(0xFFFFFFFF)
cond::time::s_timeTypeMap
static const std::pair< const char *, TimeType > s_timeTypeMap[]
Definition: Time.cc:14
cond::runnumber
Definition: Time.h:19
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:40
createfilelist.int
int
Definition: createfilelist.py:10
cond::time::SINCE_HASH_GROUP_SIZE
static constexpr unsigned int SINCE_HASH_GROUP_SIZE
Definition: Time.h:49
cond::time::MAX_VAL
const Time_t MAX_VAL(std::numeric_limits< Time_t >::max())
edm::LuminosityBlockID::value
uint64_t value() const
Definition: LuminosityBlockID.cc:13
timeUnitHelper.pack
def pack(high, low)
Definition: timeUnitHelper.py:3
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
cond::time::HASH
static constexpr TimeType HASH
Definition: Time.h:37
cond::time::time0
const boost::posix_time::ptime time0
Definition: TimeConversions.h:37
cond::UnpackedTime
std::pair< unsigned int, unsigned int > UnpackedTime
Definition: Time.h:15
writedatasetfile.run
run
Definition: writedatasetfile.py:27
cond::time::SINCE_RUN_GROUP_SIZE
static constexpr unsigned int SINCE_RUN_GROUP_SIZE
Definition: Time.h:45
BeamSpotPI::unpack
std::pair< unsigned int, unsigned int > unpack(cond::Time_t since)
Definition: BeamSpotPayloadInspectorHelper.h:23
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
cond::time::TIMESTAMP
static constexpr TimeType TIMESTAMP
Definition: Time.h:35
edm::EventID
Definition: EventID.h:31
cond::time::RUNNUMBER
static constexpr TimeType RUNNUMBER
Definition: Time.h:34
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
cond::time::SINCE_TIME_GROUP_SIZE
static constexpr unsigned long SINCE_TIME_GROUP_SIZE
Definition: Time.h:47
cond::time::LUMIID
static constexpr TimeType LUMIID
Definition: Time.h:36
cond::TimeTypeSpecs
Definition: Time.h:35
DBConfiguration_cff.timetype
timetype
Definition: DBConfiguration_cff.py:23
edm::Timestamp
Definition: Timestamp.h:30