00001 #include "RecoLuminosity/TCPReceiver/interface/TimeStamp.h" 00002 00003 #include <sstream> 00004 #include <iomanip> 00005 00006 std::string HCAL_HLX::TimeStamp::TimeStampLong(){ 00007 00008 time_t rawtime; 00009 time(&rawtime); 00010 00011 return ctime(&rawtime); 00012 } 00013 00014 std::string HCAL_HLX::TimeStamp::TimeStampYYYYMMDD(){ 00015 00016 time_t rawtime; 00017 struct tm* timeinfo; 00018 00019 rawtime = time(NULL); 00020 timeinfo = localtime(&rawtime); 00021 00022 std::ostringstream out; 00023 out.str(std::string()); 00024 out << std::setfill('0') << std::setw(4) << timeinfo->tm_year + 1900; 00025 out << std::setfill('0') << std::setw(2) << timeinfo->tm_mon + 1; 00026 out << std::setfill('0') << std::setw(2) << timeinfo->tm_mday; 00027 00028 return out.str(); 00029 } 00030 00031 std::string HCAL_HLX::TimeStamp::TimeStampYYYYMM(){ 00032 00033 time_t rawtime; 00034 struct tm* timeinfo; 00035 00036 rawtime = time(NULL); 00037 timeinfo = localtime(&rawtime); 00038 00039 std::ostringstream out; 00040 out.str(std::string()); 00041 out << std::setfill('0') << std::setw(4) << timeinfo->tm_year + 1900; 00042 out << std::setfill('0') << std::setw(2) << timeinfo->tm_mon + 1; 00043 00044 return out.str(); 00045 }