aboutsummaryrefslogtreecommitdiff
path: root/src/rpcprotocol.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-05-08 18:01:10 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-05-23 15:23:11 +0200
commit3e8ac6af9a993e262d1160fb2e6e1e1f1d5d19f2 (patch)
treed6b1b2b531923e73bc5142693009d38b4a628d1a /src/rpcprotocol.cpp
parenta60838d09aed4d976e9343e8329d61afff204435 (diff)
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.
Diffstat (limited to 'src/rpcprotocol.cpp')
-rw-r--r--src/rpcprotocol.cpp10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/rpcprotocol.cpp b/src/rpcprotocol.cpp
index 5cbaa535ab..2718f81783 100644
--- a/src/rpcprotocol.cpp
+++ b/src/rpcprotocol.cpp
@@ -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)