CMS 3D CMS Logo

TimeStamp.cc
Go to the documentation of this file.
2 
3 #include <sstream>
4 #include <iomanip>
5 
7 
8  if( rawtime == 0 )
9  time(&rawtime);
10 
11  return ctime(&rawtime);
12 }
13 
15 
16  std::string tempStr = TimeStampYYYYMMDD( rawtime );
17  return tempStr.substr(0,6);
18 }
19 
21 
22  if( rawtime == 0 )
23  time(&rawtime);
24 
25  struct tm* timeinfo;
26  timeinfo = localtime(&rawtime);
27 
28  std::ostringstream out;
29  out.str(std::string());
30  out << std::setfill('0') << std::setw(4) << timeinfo->tm_year + 1900;
31  out << std::setfill('0') << std::setw(2) << timeinfo->tm_mon + 1;
32  out << std::setfill('0') << std::setw(2) << timeinfo->tm_mday;
33 
34  return out.str();
35 }
std::string TimeStampYYYYMM(time_t rawtime=0)
Definition: TimeStamp.cc:14
std::string TimeStampLong(time_t rawtime=0)
Definition: TimeStamp.cc:6
std::string TimeStampYYYYMMDD(time_t rawtime=0)
Definition: TimeStamp.cc:20