Migrate off of posix_time and most uses of C time_t.

This commit is contained in:
Howard Hinnant
2016-04-26 19:32:57 -04:00
committed by Vinnie Falco
parent 2e2a7509cd
commit 5d9e53a37d
26 changed files with 174 additions and 166 deletions

View File

@@ -36,10 +36,15 @@ std::string getHTTPHeaderTimestamp ()
char buffer[96];
time_t now;
time (&now);
struct tm* now_gmt = gmtime (&now);
struct tm now_gmt{};
#ifndef _MSC_VER
gmtime_r(&now, &now_gmt);
#else
gmtime_s(&now_gmt, &now);
#endif
strftime (buffer, sizeof (buffer),
"Date: %a, %d %b %Y %H:%M:%S +0000\r\n",
now_gmt);
&now_gmt);
return std::string (buffer);
}