src
OnlineDB
EcalCondDB
src
DateHandler.cc
Go to the documentation of this file.
1
#include "
OnlineDB/Oracle/interface/Oracle.h
"
2
#include "
OnlineDB/EcalCondDB/interface/Tm.h
"
3
#include "
OnlineDB/EcalCondDB/interface/DateHandler.h
"
4
5
using namespace
oracle::occi
;
6
7
DateHandler::DateHandler
(Environment*
env
, Connection*
conn
) {
8
m_env =
env
;
9
m_conn =
conn
;
10
11
PLUS_INF_DATE = maxDate();
12
PLUS_INF = dateToTm(PLUS_INF_DATE);
13
NEG_INF_DATE = minDate();
14
NEG_INF = dateToTm(NEG_INF_DATE);
15
}
16
17
DateHandler::~DateHandler
() {}
18
19
Date
DateHandler::tmToDate
(
const
Tm
& inTm)
const
{
20
if
(inTm.
isNull
()) {
21
return
Date();
22
}
else
{
23
struct
tm ctm = inTm.
c_tm
();
24
return
Date(m_env, ctm.tm_year + 1900, ctm.tm_mon + 1, ctm.tm_mday, ctm.tm_hour, ctm.tm_min, ctm.tm_sec);
25
}
26
}
27
28
Tm
DateHandler::dateToTm
(Date& date)
const
{
29
if
(date.isNull()) {
30
return
Tm
();
31
}
32
33
int
year
;
34
unsigned
int
mon
;
// month
35
unsigned
int
mday;
// day of month
36
unsigned
int
hour;
37
unsigned
int
min
;
// minute
38
unsigned
int
sec
;
// second
39
40
date.getDate(
year
,
mon
, mday, hour,
min
,
sec
);
41
42
// work on the provided tm
43
struct
tm retTm;
44
retTm.tm_year =
year
- 1900;
45
retTm.tm_mon =
mon
- 1;
46
retTm.tm_mday = mday;
47
retTm.tm_hour = hour;
48
retTm.tm_min =
min
;
49
retTm.tm_sec =
sec
;
50
retTm.tm_isdst = 0;
51
retTm.tm_wday = 0;
52
retTm.tm_yday = 0;
53
54
mktime(&retTm);
// calculates tm_wday and tm_yday
55
56
return
Tm
(&retTm);
57
}
DateHandler.h
DateHandler::tmToDate
oracle::occi::Date tmToDate(const Tm &inTm) const
Definition:
DateHandler.cc:19
Tm::c_tm
struct tm c_tm() const
Definition:
Tm.cc:42
Oracle.h
LaserDQM_cfi.mon
mon
Definition:
LaserDQM_cfi.py:3
SiStripPI::min
Definition:
SiStripPayloadInspectorHelper.h:178
Tm.h
web.browse_db.env
env
Definition:
browse_db.py:18
Tm::isNull
int isNull() const
Definition:
Tm.cc:44
DateHandler::dateToTm
Tm dateToTm(oracle::occi::Date &date) const
Definition:
DateHandler.cc:28
DateHandler::~DateHandler
~DateHandler()
Definition:
DateHandler.cc:17
oracle::occi
Definition:
ConnectionManager.h:7
DateHandler::DateHandler
DateHandler()=delete
fileinputsource_cfi.sec
sec
Definition:
fileinputsource_cfi.py:88
HLT_2024v11_cff.year
year
Definition:
HLT_2024v11_cff.py:60654
getInfo.conn
conn
Definition:
getInfo.py:9
Tm
Definition:
Tm.h:13
Generated for CMSSW Reference Manual by
1.8.14