mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-04 06:12:07 +01:00
Replace non-threadsafe gmtime and setlocale
Make DateTimeStrFormat use boost::posix_time.
Also re-enable the util_DateTimeStrFormat tests, as they are no
longer platform specific.
Rebased-By: Wladimir J. van der Laan <laanwj@gmail.com>
Rebased-From: 3e8ac6a
This commit is contained in:
@@ -51,15 +51,7 @@ string HTTPPost(const string& strMsg, const map<string,string>& mapRequestHeader
|
||||
|
||||
static string rfc1123Time()
|
||||
{
|
||||
char buffer[64];
|
||||
time_t now;
|
||||
time(&now);
|
||||
struct tm* now_gmt = gmtime(&now);
|
||||
string locale(setlocale(LC_TIME, NULL));
|
||||
setlocale(LC_TIME, "C"); // we want POSIX (aka "C") weekday/month strings
|
||||
strftime(buffer, sizeof(buffer), "%a, %d %b %Y %H:%M:%S +0000", now_gmt);
|
||||
setlocale(LC_TIME, locale.c_str());
|
||||
return string(buffer);
|
||||
return DateTimeStrFormat("%a, %d %b %Y %H:%M:%S +0000", GetTime());
|
||||
}
|
||||
|
||||
string HTTPReply(int nStatus, const string& strMsg, bool keepalive)
|
||||
|
||||
Reference in New Issue
Block a user