Guest User

Untitled

a guest
Sep 3rd, 2016
101
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. inline std::string dateTimeNow()
  2. {
  3.     const int RFC1123_TIME_LEN = 29;
  4.     time_t t;
  5.     struct tm *tm;
  6.  
  7.     std::string ret;
  8.     ret.resize(RFC1123_TIME_LEN);
  9.  
  10.     time(&t);
  11.     tm = localtime(&t);
  12.  
  13.     strftime(&ret[0], RFC1123_TIME_LEN + 1, "%a, %d %b %Y %H:%M:%S %z", tm);
  14.  
  15.     return ret;
  16. }
RAW Paste Data