Package: libboost-date-time-dev
Version: 1.34.1-9
Severity: important
Tags: patch
The function boost::posix_time::to_iso_string_type() uses the
ostream::operator<<() function to write the time. This later function
will use the current global locale to format each of the elements of
the time. In particular, when the global locale is set to en_US, the
fractional will be formatted to be 123,456 when there are six digits,
which is incorrect.
The proposed solution is to temporarily imbue the ostream with the
classic locale to disable formatting. The attached patch only applies
this to the fractional seconds but it would be more robust to apply to
the other time components as well.
This defect has already been reported upstream
http://svn.boost.org/trac/boost/ticket/1726.
This defect is similar to Debian Bug#469771.
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.24-qi.workstation (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages libboost-date-time-dev depends on:
ii libboost-date-time1.34.1 1.34.1-9 set of date-time libraries based
o
ii libboost-dev 1.34.1-9 Boost C++ Libraries development
fi
libboost-date-time-dev recommends no packages.
-- no debconf information
diff -r -u boost.orig/date_time/posix_time/time_formatters.hpp boost/date_time/posix_time/time_formatters.hpp
--- boost.orig/date_time/posix_time/time_formatters.hpp 2008-03-28 18:27:41.000000000 -0400
+++ boost/date_time/posix_time/time_formatters.hpp 2008-03-28 18:31:09.000000000 -0400
@@ -144,6 +144,9 @@
date_time::absolute_value(td.fractional_seconds());
#endif
if (frac_sec != 0) {
+ // Temporarily switch to classic locale to prevent possible formatting
+ // of frac_sec with comma or other character (for example 123,456).
+ ss.imbue(std::locale::classic());
ss << "." << std::setw(time_duration::num_fractional_digits())
<< std::setfill(fill_char)
@@ -153,6 +156,7 @@
#else
<< frac_sec;
#endif
+ ss.imbue(std::locale::locale());
}
}// else
return ss.str();