changeset 524:9064f09fef78 draft

Set time locale to POSIX in rfc1123Time so weekday/months in http responses are correct.
author Gavin Andresen <gavinandresen@gmail.com>
date Wed, 13 Apr 2011 15:06:48 -0400
parents 9cb4838fd262
children 8ced62a7b4f2
files rpc.cpp
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/rpc.cpp
+++ b/rpc.cpp
@@ -1498,7 +1498,10 @@
     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);
 }