ext/boost/date_time/date_formatting.hpp in passenger-3.0.21 vs ext/boost/date_time/date_formatting.hpp in passenger-3.9.1.beta
- old
+ new
@@ -4,11 +4,11 @@
/* Copyright (c) 2002-2004 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
- * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
+ * $Date: 2012-01-30 21:30:03 -0500 (Mon, 30 Jan 2012) $
*/
#include "boost/date_time/iso_format.hpp"
#include "boost/date_time/compiler_config.hpp"
#include <string>
@@ -77,10 +77,16 @@
*/
static std::basic_string<charT> ymd_to_string(ymd_type ymd)
{
typedef typename ymd_type::month_type month_type;
std::basic_ostringstream<charT> ss;
+
+ // Temporarily switch to classic locale to prevent possible formatting
+ // of year with comma or other character (for example 2,008).
+ ss.imbue(std::locale::classic());
ss << ymd.year;
+ ss.imbue(std::locale());
+
if (format_type::has_date_sep_chars()) {
ss << format_type::month_sep_char();
}
//this name is a bit ugly, oh well....
month_formatter<month_type,format_type,charT>::format_month(ymd.month, ss);