CMS 3D CMS Logo

List of all members | Public Member Functions
HCAL_HLX::TimeStamp Class Reference

#include <TimeStamp.h>

Public Member Functions

std::string TimeStampLong (time_t rawtime=0)
 
std::string TimeStampYYYYMM (time_t rawtime=0)
 
std::string TimeStampYYYYMMDD (time_t rawtime=0)
 

Detailed Description

Definition at line 9 of file TimeStamp.h.

Member Function Documentation

std::string HCAL_HLX::TimeStamp::TimeStampLong ( time_t  rawtime = 0)

Definition at line 6 of file TimeStamp.cc.

References ntuplemaker::time.

6  {
7  if (rawtime == 0)
8  time(&rawtime);
9 
10  return ctime(&rawtime);
11 }
std::string HCAL_HLX::TimeStamp::TimeStampYYYYMM ( time_t  rawtime = 0)

Definition at line 13 of file TimeStamp.cc.

References AlCaHLTBitMon_QueryRunRegistry::string, and TimeStampYYYYMMDD().

13  {
14  std::string tempStr = TimeStampYYYYMMDD(rawtime);
15  return tempStr.substr(0, 6);
16 }
std::string TimeStampYYYYMMDD(time_t rawtime=0)
Definition: TimeStamp.cc:18
std::string HCAL_HLX::TimeStamp::TimeStampYYYYMMDD ( time_t  rawtime = 0)

Definition at line 18 of file TimeStamp.cc.

References MillePedeFileConverter_cfg::out, AlCaHLTBitMon_QueryRunRegistry::string, and ntuplemaker::time.

Referenced by TimeStampYYYYMM().

18  {
19  if (rawtime == 0)
20  time(&rawtime);
21 
22  struct tm* timeinfo;
23  timeinfo = localtime(&rawtime);
24 
25  std::ostringstream out;
26  out.str(std::string());
27  out << std::setfill('0') << std::setw(4) << timeinfo->tm_year + 1900;
28  out << std::setfill('0') << std::setw(2) << timeinfo->tm_mon + 1;
29  out << std::setfill('0') << std::setw(2) << timeinfo->tm_mday;
30 
31  return out.str();
32 }