Opened 9 years ago

Last modified 9 years ago

#9089 new Bugs

missing locale in strings_from_facet.hpp

Reported by: Jackarain Owned by: az_sw_dude
Milestone: To Be Determined Component: date_time
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc: jack.wgm@…

Description

see my example:

 std::locale::global(std::locale(""));
 boost::posix_time::ptime t;
 std::stringstream ss;
 std::string s = "Sat, 07-Sep-43 10:40:59 GMT";
 ss.str(s);
 boost::posix_time::time_input_facet* rfc850_date_workarround2 =
     new boost::posix_time::time_input_facet("%a, %d-%b-%y %H:%M:%S GMT");
 ss.imbue(std::locale(std::locale::classic(), rfc850_date_workarround2));
 ss >> t;
 if (t != boost::posix_time::not_a_date_time)
 {
    std::cout << ss.str() << std::endl;
 }

I expected the output:

2043-Sep-07 10:40:59

but in fact no output...

Attachments (1)

strings_from_facet.hpp.patch (848 bytes ) - added by Jackarain 9 years ago.
fixed missing locale in strings_from_facet.hpp

Download all attachments as: .zip

Change History (2)

by Jackarain, 9 years ago

fixed missing locale in strings_from_facet.hpp

comment:1 by Marshall Clow, 9 years ago

I just tried this with both the current trunk and the 1.55.0 release (Clang 3.4, Mac OS X 10.9), and got the output that you expected in both cases.

Can you provide more information about your setup? (OS, compiler, etc)? Does this occur for you with boost 1.55.0?

Note: See TracTickets for help on using tickets.