Modify

Opened 10 years ago

#1726 new Bugs

boost/date_time/posix_time/time_formatters.hpp incorrectly formats fractional seconds using global locale

Reported by: jplejacq@… 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)

boost_date_time_posix_time_time_formatters_hpp.patch (875 bytes) - added by jplejacq@… 10 years ago.
patch
boost-date-time-1726.patch (824 bytes) - added by Dean Michael Berris 7 years ago.
Updated patch to apply cleanly to r68583 on trunk.

Download all attachments as: .zip

Change History (2)

Changed 10 years ago by jplejacq@…

patch

Changed 7 years ago by Dean Michael Berris

Attachment: boost-date-time-1726.patch added

Updated patch to apply cleanly to r68583 on trunk.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain az_sw_dude.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.