Util.cpp 316 B

12345678910111213141516171819202122
  1. #include "Util.h"
  2. #include <ctime>
  3. #include <string>
  4. namespace Util {
  5. std::string getTimeString()
  6. {
  7. time_t rawtime;
  8. struct tm* timeinfo;
  9. char buffer[80];
  10. time (&rawtime);
  11. timeinfo = localtime(&rawtime);
  12. strftime(buffer, 80, "%Y%m%d-%H%M%S", timeinfo);
  13. return std::string(buffer);
  14. }
  15. } // namespace Util