Opened 15 years ago
#1726 new Bugs
boost/date_time/posix_time/time_formatters.hpp incorrectly formats fractional seconds using global locale
Reported by: | Owned by: | az_sw_dude | |
---|---|---|---|
Milestone: | To Be Determined | Component: | date_time |
Version: | Boost 1.34.1 | Severity: | Problem |
Keywords: | locale | Cc: |
Description
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 type of error probably exists in other functions. In particular see Ticket #1674 which is the same error.
Attachments (2)
Change History (2)
by , 15 years ago
Attachment: | boost_date_time_posix_time_time_formatters_hpp.patch added |
---|
by , 12 years ago
Attachment: | boost-date-time-1726.patch added |
---|
Updated patch to apply cleanly to r68583 on trunk.
patch