Definition at line 13 of file Tm.h.
void Tm::setToString |
( |
const std::string |
s | ) |
|
|
noexcept |
Definition at line 193 of file Tm.cc.
References alignCSCRings::e, visualization-live-secondInstance_cfg::msg, and alignCSCRings::s.
Referenced by LMFCorrCoefDat::fetchAfter(), LMFCorrCoefDat::fetchBetween(), RunDCSHVDat::fillTheMapByTime(), LMFRunIOV::getDBInsertionTime(), LMFLmrSubIOV::getIOVIDsLaterThan(), popcon::EcalLaserHandler::getNewObjects(), LMFSeqDat::getSequenceStart(), LMFSeqDat::getSequenceStop(), LMFRunIOV::getSubRunEnd(), and LMFRunIOV::getSubRunStart().
196 sscanf(
s.c_str(),
"%04d-%02d-%02d %02d:%02d:%02d",
201 if (
m_tm.tm_year > 9999 ||
m_tm.tm_year < 1900) {
202 throw(std::runtime_error(
"Year out of bounds"));
203 }
else if (
m_tm.tm_mon > 12 ||
m_tm.tm_mon < 1) {
204 throw(std::runtime_error(
"Month out of bounds"));
205 }
else if (
m_tm.tm_mday > 31 ||
m_tm.tm_mday < 1) {
206 throw(std::runtime_error(
"Day out of bounds"));
207 }
else if (
m_tm.tm_hour > 23 ||
m_tm.tm_mday < 0) {
208 throw(std::runtime_error(
"Hour out of bounds"));
209 }
else if (
m_tm.tm_min > 59 ||
m_tm.tm_min < 0) {
210 throw(std::runtime_error(
"Minute out of bounds"));
211 }
else if (
m_tm.tm_sec > 59 ||
m_tm.tm_sec < 0) {
212 throw(std::runtime_error(
"Day out of bounds"));
215 if (
m_tm.tm_year >= 2038) {
218 if (
m_tm.tm_mon > 1) {
221 if (
m_tm.tm_mday > 19) {
224 if (
m_tm.tm_hour > 3) {
227 if (
m_tm.tm_min > 14) {
230 if (
m_tm.tm_sec > 7) {
234 m_tm.tm_year -= 1900;
236 }
catch (std::runtime_error &
e) {
238 string msg(
"Tm::setToString(): ");
239 msg.append(e.what());
240 throw(std::runtime_error(
msg));
"One hour shif" fix Create a temporary dummy object that is in GMT and use it to generate the output. This is to avoid the "one hour
shift" related to the Summer time and the value of m_tm.tm_isdst, see [1]. It guaranties that the output is always in GMT / UTC. [1] https://hypernews.cern.ch/HyperNews/CMS/get/ecalDB/66.html
Definition at line 89 of file Tm.cc.
References c_tm(), setToGMTime(), and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by LMFCorrCoefDat::fetchBetween(), LMFSeqDat::fetchByRunNumber(), RunDCSHVDat::fillTheMapByTime(), LMFCorrCoefDat::getCorrections(), popcon::EcalLaserHandler::getNewObjects(), LMFRunIOV::getParameters(), LMFSeqDat::getParameters(), DataReducer< T >::getReducedDataList(), LMFRunIOV::initialize(), LMFSeqDat::LMFSeqDat(), operator<<(), EcalTPGDBApp::printIOV(), LMFUnique::sequencePostfix(), LMFSeqDat::setSequenceStart(), LMFSeqDat::setSequenceStop(), LMFRunIOV::setSubRunEnd(), and LMFRunIOV::setSubRunStart().
104 char timebuf[20] =
"";
106 sprintf(timebuf,
"9999-12-12 23:59:59");
110 struct tm dummy_tm = dummy_Tm.
c_tm();
111 strftime(timebuf, 20,
"%Y-%m-%d %H:%M:%S", &dummy_tm);
uint64_t microsTime() const
void setToGMTime(time_t t)
static const uint64_t PLUS_INF_MICROS