00001 #ifndef PixelTimeFormatter_h 00002 #define PixelTimeFormatter_h 00003 00010 #include <iostream> 00011 #include <sstream> 00012 #include <string> 00013 #include <time.h> 00014 00015 namespace pos{ 00016 class PixelTimeFormatter 00017 { 00018 public: 00019 static std::string getTime(void) 00020 { 00021 char theDate[20] ; 00022 struct tm *thisTime; 00023 time_t aclock; 00024 std::string date ; 00025 time( &aclock ); 00026 thisTime = localtime( &aclock ); 00027 00028 sprintf(theDate, 00029 "%d-%02d-%02d %02d:%02d:%02d", thisTime->tm_year+1900, 00030 thisTime->tm_mon+1, 00031 thisTime->tm_mday, 00032 thisTime->tm_hour, 00033 thisTime->tm_min, 00034 thisTime->tm_sec ); 00035 date = theDate ; 00036 std::cout << "[PixelTimeFormatter::getTime()]\t\t\t\t Time: " << date << std::endl ; 00037 return date ; 00038 } 00039 } ; 00040 } 00041 00042 #endif