Browse Source

[5088] Use classic locale in HTTP date/time functions.

Marcin Siodelski 8 years ago
parent
commit
11d5c1c36f
1 changed files with 3 additions and 2 deletions
  1. 3 2
      src/lib/http/date_time.cc

+ 3 - 2
src/lib/http/date_time.cc

@@ -7,6 +7,7 @@
 #include <http/date_time.h>
 #include <boost/date_time/time_facet.hpp>
 #include <boost/date_time/local_time/local_time.hpp>
+#include <locale>
 #include <sstream>
 
 using namespace boost::local_time;
@@ -109,7 +110,7 @@ HttpDateTime::toString(const std::string& format,
     // Create raw pointer. The output stream will take responsibility for
     // deleting the object.
     time_facet* df(new time_facet(format.c_str()));
-    s.imbue(std::locale(s.getloc(), df));
+    s.imbue(std::locale(std::locale::classic(), df));
 
     // Convert time value to a string.
     s << time_;
@@ -131,7 +132,7 @@ HttpDateTime::fromString(const std::string& time_string,
     // Create raw pointer. The input stream will take responsibility for
     // deleting the object.
     time_input_facet* tif(new time_input_facet(format));
-    s.imbue(std::locale(s.getloc(), tif));
+    s.imbue(std::locale(std::locale::classic(), tif));
 
     time_zone_ptr zone(new posix_time_zone("GMT"));
     local_date_time ldt = local_microsec_clock::local_time(zone);