File indexing completed on 2024-04-06 12:01:25
0001 #ifndef CondCore_CondDB_Time_h
0002 #define CondCore_CondDB_Time_h
0003
0004 #include "CondFormats/Common/interface/Time.h"
0005 #include "CondFormats/Common/interface/TimeConversions.h"
0006 #include "FWCore/Framework/interface/IOVSyncValue.h"
0007
0008 #include <string>
0009 #include <limits>
0010 #include <type_traits>
0011
0012
0013 namespace cond {
0014
0015 namespace time {
0016
0017
0018 typedef cond::Time_t Time_t;
0019
0020 const Time_t MAX_VAL(std::numeric_limits<Time_t>::max());
0021
0022 const Time_t MIN_VAL(0);
0023
0024 const unsigned int SECONDS_PER_LUMI(23);
0025
0026 static constexpr const char* const MAX_TIMESTAMP = "9999-12-31 23:59:59.000";
0027
0028 typedef cond::UnpackedTime UnpackedTime;
0029
0030 typedef cond::TimeType TimeType;
0031
0032
0033 static constexpr TimeType INVALID = cond::invalid;
0034 static constexpr TimeType RUNNUMBER = cond::runnumber;
0035 static constexpr TimeType TIMESTAMP = cond::timestamp;
0036 static constexpr TimeType LUMIID = cond::lumiid;
0037 static constexpr TimeType HASH = cond::hash;
0038 static constexpr TimeType USERID = cond::userid;
0039
0040 std::string timeTypeName(TimeType type);
0041
0042 TimeType timeTypeFromName(const std::string& name);
0043
0044
0045 static constexpr unsigned int SINCE_RUN_GROUP_SIZE = 1000;
0046
0047 static constexpr unsigned long SINCE_TIME_GROUP_SIZE = 154618822656000;
0048 static constexpr unsigned int SINCE_LUMI_GROUP_SIZE = SINCE_RUN_GROUP_SIZE;
0049 static constexpr unsigned int SINCE_HASH_GROUP_SIZE = SINCE_RUN_GROUP_SIZE;
0050
0051 Time_t sinceGroupSize(TimeType tp);
0052
0053 Time_t tillTimeFromNextSince(Time_t nextSince, TimeType timeType);
0054
0055 Time_t tillTimeForIOV(Time_t since, unsigned int iovSize, TimeType timeType);
0056
0057 Time_t lumiTime(unsigned int run, unsigned int lumiId);
0058
0059
0060 edm::IOVSyncValue toIOVSyncValue(cond::Time_t time, TimeType timetype, bool startOrStop);
0061
0062 Time_t fromIOVSyncValue(edm::IOVSyncValue const& time, TimeType timetype);
0063
0064
0065 edm::IOVSyncValue limitedIOVSyncValue(Time_t time, TimeType timetype);
0066
0067 edm::IOVSyncValue limitedIOVSyncValue(edm::IOVSyncValue const& time, TimeType timetype);
0068
0069 std::string transactionIdForLumiTime(Time_t time, unsigned int iovSize, const std::string& secretKey);
0070
0071 }
0072
0073 }
0074 #endif