CMS 3D CMS Logo

Tm Class Reference

#include <OnlineDB/EcalCondDB/interface/Tm.h>

List of all members.

Public Member Functions

struct tm c_tm () const
void dumpTm ()
int isNull () const
uint64_t microsTime () const
bool operator!= (const Tm &t) const
bool operator== (const Tm &t) const
void setNull ()
void setToCurrentGMTime ()
void setToCurrentLocalTime ()
void setToGMTime (time_t t)
void setToLocalTime (time_t t)
void setToMicrosTime (uint64_t micros)
void setToString (const std::string s) throw (std::runtime_error)
std::string str () const
 Tm (uint64_t micros)
 Tm (struct tm *initTm)
 Tm ()
virtual ~Tm ()

Static Public Member Functions

static Tm negInfinity ()
static Tm plusInfinity ()

Private Attributes

struct tm m_tm

Static Private Attributes

static const uint64_t NEG_INF_MICROS = 0
static const uint64_t PLUS_INF_MICROS = (uint64_t)-1


Detailed Description

Definition at line 13 of file Tm.h.


Constructor & Destructor Documentation

Tm::Tm (  ) 

Definition at line 14 of file Tm.cc.

References setNull().

Referenced by negInfinity(), and plusInfinity().

00015 {
00016   this->setNull();
00017 }

Tm::Tm ( struct tm *  initTm  ) 

Definition at line 22 of file Tm.cc.

References m_tm.

00023 {
00024   m_tm = *initTm;
00025 }

Tm::Tm ( uint64_t  micros  ) 

Definition at line 27 of file Tm.cc.

References setNull(), and setToMicrosTime().

00028 {
00029   this->setNull();
00030   this->setToMicrosTime(micros);
00031 }

Tm::~Tm (  )  [virtual]

Definition at line 35 of file Tm.cc.

00036 {
00037 }


Member Function Documentation

struct tm Tm::c_tm (  )  const [read]

Definition at line 41 of file Tm.cc.

References m_tm.

Referenced by DateHandler::tmToDate().

00042 {
00043   return m_tm;
00044 }

void Tm::dumpTm (  ) 

Definition at line 160 of file Tm.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and m_tm.

00161 {
00162   cout << "=== dumpTm() ===" << endl;
00163   cout << "tm_year  " << m_tm.tm_year << endl;
00164   cout << "tm_mon   " << m_tm.tm_mon << endl;
00165   cout << "tm_mday  " << m_tm.tm_mday << endl;
00166   cout << "tm_hour  " << m_tm.tm_hour << endl;
00167   cout << "tm_min   " << m_tm.tm_min << endl;
00168   cout << "tm_sec   " << m_tm.tm_sec << endl;
00169   cout << "tm_yday  " << m_tm.tm_yday << endl;
00170   cout << "tm_wday  " << m_tm.tm_wday << endl;
00171   cout << "tm_isdst " << m_tm.tm_isdst << endl;
00172   cout << "================" << endl;
00173 }

int Tm::isNull ( void   )  const

Definition at line 48 of file Tm.cc.

References m_tm.

Referenced by RunIOV::fetchID(), CaliIOV::fetchID(), LMFRunIOV::fetchID(), MonRunIOV::fetchID(), DCUIOV::fetchID(), DateHandler::tmToDate(), RunIOV::updateEndTimeDB(), DCUIOV::writeDB(), RunIOV::writeDB(), LMFRunIOV::writeDB(), CaliIOV::writeDB(), ODCond2ConfInfo::writeDB(), and MonRunIOV::writeDB().

00049 {
00050   if (m_tm.tm_year == 0
00051       && m_tm.tm_mon == 0
00052       && m_tm.tm_mday == 0 ) {
00053     return 1;
00054   } else { return 0; }
00055 }

uint64_t Tm::microsTime (  )  const

Definition at line 87 of file Tm.cc.

References m_tm, and HLT_VtxMuL3::result.

00088 {
00089   uint64_t result = 0;
00090   
00091   result += (uint64_t)ceil((m_tm.tm_year + 1900 - 1970) * 365.25) * 24 * 3600;
00092   result += m_tm.tm_yday * 24 * 3600;
00093   result += m_tm.tm_hour * 3600;
00094   result += m_tm.tm_min * 60;
00095   result += m_tm.tm_sec;
00096   
00097   return (uint64_t) (result * 1000000);
00098 }

static Tm Tm::negInfinity (  )  [inline, static]

Definition at line 51 of file Tm.h.

References NEG_INF_MICROS, and Tm().

00052     {
00053       return Tm(NEG_INF_MICROS);
00054     };

bool Tm::operator!= ( const Tm t  )  const [inline]

Definition at line 102 of file Tm.h.

00102 { return !(t == *this); }

bool Tm::operator== ( const Tm t  )  const [inline]

Definition at line 90 of file Tm.h.

References m_tm.

00091     {   return (m_tm.tm_hour  == t.m_tm.tm_hour &&
00092                 m_tm.tm_isdst == t.m_tm.tm_isdst &&
00093                 m_tm.tm_mday  == t.m_tm.tm_mday &&
00094                 m_tm.tm_min   == t.m_tm.tm_min &&
00095                 m_tm.tm_mon   == t.m_tm.tm_mon &&
00096                 m_tm.tm_sec   == t.m_tm.tm_sec &&
00097                 m_tm.tm_wday  == t.m_tm.tm_wday &&
00098                 m_tm.tm_yday  == t.m_tm.tm_yday &&
00099                 m_tm.tm_year  == t.m_tm.tm_year); 
00100     }

static Tm Tm::plusInfinity (  )  [inline, static]

Definition at line 45 of file Tm.h.

References PLUS_INF_MICROS, and Tm().

00046     {
00047       return Tm(PLUS_INF_MICROS);
00048     };

void Tm::setNull (  ) 

Definition at line 59 of file Tm.cc.

References m_tm.

Referenced by Tm().

00060 {
00061   m_tm.tm_hour  = 0;
00062   m_tm.tm_isdst = 0;
00063   m_tm.tm_mday  = 0;
00064   m_tm.tm_min   = 0;
00065   m_tm.tm_mon   = 0;
00066   m_tm.tm_sec   = 0;
00067   m_tm.tm_wday  = 0;
00068   m_tm.tm_yday  = 0;
00069   m_tm.tm_year  = 0;
00070 }

void Tm::setToCurrentGMTime (  ) 

Definition at line 112 of file Tm.cc.

References m_tm, NULL, and t.

Referenced by EcalEndcapMonitorClient::beginRunDb(), EcalBarrelMonitorClient::beginRunDb(), EcalEndcapMonitorClient::writeDb(), EcalBarrelMonitorClient::writeDb(), and EcalPedOffset::writeDb().

00113 {
00114   time_t t = time(NULL);
00115   m_tm = *gmtime( &t );
00116 }

void Tm::setToCurrentLocalTime (  ) 

Definition at line 106 of file Tm.cc.

References m_tm, NULL, and t.

00107 {
00108   time_t t = time(NULL);
00109   m_tm = *localtime( &t );
00110 }

void Tm::setToGMTime ( time_t  t  ) 

Definition at line 123 of file Tm.cc.

References m_tm.

00124 {
00125   m_tm = *gmtime( &t );
00126 }

void Tm::setToLocalTime ( time_t  t  ) 

Definition at line 118 of file Tm.cc.

References m_tm.

00119 {
00120   m_tm = *localtime( &t );
00121 }

void Tm::setToMicrosTime ( uint64_t  micros  ) 

Definition at line 100 of file Tm.cc.

References m_tm, and t.

Referenced by Tm().

00101 {
00102   time_t t = micros / 1000000;
00103   m_tm = *gmtime(&t);
00104 }

void Tm::setToString ( const std::string  s  )  throw (std::runtime_error)

string Tm::str (  )  const

Definition at line 74 of file Tm.cc.

References m_tm.

Referenced by EcalEndcapMonitorClient::beginRunDb(), EcalBarrelMonitorClient::beginRunDb(), EcalEndcapMonitorClient::defaultWebPage(), EcalBarrelMonitorClient::defaultWebPage(), EcalTPGDBApp::printIOV(), EcalEndcapMonitorClient::writeDb(), and EcalBarrelMonitorClient::writeDb().

00075 {
00076   if (this->isNull()) {
00077     return "";
00078   }
00079 
00080   char timebuf[20] = "";
00081   strftime(timebuf, 20, "%Y-%m-%d %H:%M:%S", &m_tm);
00082   return string(timebuf);
00083 }


Member Data Documentation

struct tm Tm::m_tm [read, private]

Definition at line 105 of file Tm.h.

Referenced by c_tm(), dumpTm(), isNull(), microsTime(), operator==(), setNull(), setToCurrentGMTime(), setToCurrentLocalTime(), setToGMTime(), setToLocalTime(), setToMicrosTime(), str(), and Tm().

const uint64_t Tm::NEG_INF_MICROS = 0 [static, private]

Definition at line 14 of file Tm.h.

Referenced by negInfinity().

const uint64_t Tm::PLUS_INF_MICROS = (uint64_t)-1 [static, private]

Definition at line 15 of file Tm.h.

Referenced by plusInfinity().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:33:39 2009 for CMSSW by  doxygen 1.5.4