linux版本中间件

Util.cpp 433B

12345678910111213141516171819202122232425
  1. #include "Util.h"
  2. #include <regex>
  3. std::string Util::CurTime()
  4. {
  5. return __FormatTime(__getCurTime());
  6. }
  7. date Util::CurData()
  8. {
  9. return day_clock::local_day(); //获取当前日期比如:20130716
  10. }
  11. std::string Util::__FormatTime(ptime time)
  12. {
  13. std::string now = to_iso_extended_string(time);
  14. std::regex reg("T");
  15. return std::regex_replace(now, reg, " ");
  16. }
  17. ptime Util::__getCurTime()
  18. {
  19. return second_clock::local_time();
  20. }