Guest User

Untitled

a guest
Sep 3rd, 2016
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  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. }
Add Comment
Please, Sign In to add comment