CMS 3D CMS Logo

Public Member Functions

HCAL_HLX::TimeStamp Class Reference

#include <TimeStamp.h>

Inheritance diagram for HCAL_HLX::TimeStamp:
HCAL_HLX::ROOTSchema

List of all members.

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 cond::rpcobgas::time.

                                                          {

  if( rawtime == 0 )
    time(&rawtime);

  return ctime(&rawtime);
}
std::string HCAL_HLX::TimeStamp::TimeStampYYYYMM ( time_t  rawtime = 0)

Definition at line 14 of file TimeStamp.cc.

                                                            {

  std::string tempStr = TimeStampYYYYMMDD( rawtime );
  return tempStr.substr(0,6);
}
std::string HCAL_HLX::TimeStamp::TimeStampYYYYMMDD ( time_t  rawtime = 0)

Definition at line 20 of file TimeStamp.cc.

References dbtoconf::out, and cond::rpcobgas::time.

                                                              {

  if( rawtime == 0 ) 
    time(&rawtime);

  struct tm* timeinfo;
  timeinfo = localtime(&rawtime);

  std::ostringstream out;
  out.str(std::string());
  out << std::setfill('0') << std::setw(4) << timeinfo->tm_year + 1900;
  out << std::setfill('0') << std::setw(2) << timeinfo->tm_mon + 1;
  out << std::setfill('0') << std::setw(2) << timeinfo->tm_mday;

  return out.str();
}