aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2011-04-13 15:06:48 -0400
committerGavin Andresen <gavinandresen@gmail.com>2011-04-15 12:01:34 -0400
commit9ff411f7f7f14bcf2643cc54591a9b35ce91cfd2 (patch)
tree305caeb89e38d7f37aeafa0b7e9a15eb7d10785e
parentb37f09aa2e80b17028ad7fe1e87362c0f07c7406 (diff)
downloadbitcoin-9ff411f7f7f14bcf2643cc54591a9b35ce91cfd2.tar.xz
Set time locale to POSIX in rfc1123Time so weekday/months in http responses are correct.
-rw-r--r--rpc.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/rpc.cpp b/rpc.cpp
index 93df5c22a4..a395f9d236 100644
--- a/rpc.cpp
+++ b/rpc.cpp
@@ -1498,7 +1498,10 @@ string rfc1123Time()
time_t now;
time(&now);
struct tm* now_gmt = gmtime(&now);
- strftime(buffer, sizeof(buffer), "%a, %d %b %Y %H:%M:%S %Z", now_gmt);
+ 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);
}