Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#3876 closed Bugs (fixed)

%T format specifier with local_time_facet crashes with MSVC 9

Reported by: Claudio Bley Owned by: az_sw_dude
Milestone: Boost 1.42.0 Component: date_time
Version: Boost 1.41.0 Severity: Problem
Keywords: Cc:


The following program crashes with MSVC9 when trying to write the local_date_time to the stringstream:

#include <boost/date_time/local_time/local_time.hpp> 
#include <iostream>
#include <string>
#include <sstream>

    using namespace boost::posix_time;
    using namespace boost::local_time;

    time_zone_ptr utc;
    local_date_time now(microsec_clock::universal_time(), utc);

    local_time_facet* output_facet = new local_time_facet();
    local_time_input_facet* input_facet = new local_time_input_facet();

    std::stringstream ss;
    ss.imbue(std::locale(std::locale::classic(), output_facet));
    ss.imbue(std::locale(ss.getloc(), input_facet)); 

    // %T !  The time in 24-hour notation (%H:%M:%S)

    ss << now; // crash in _Strftime_l

With MinGW 4.4.0 it just ignores the %T format specifier. What's the deal with %T?

Attachments (0)

Change History (4)

comment:1 Changed 7 years ago by Andrey Semashev

This placeholder is not standard, but Boost.DateTime? doesn't handle it itself. This should either be mentioned in docs or fixed in the code.

comment:2 Changed 7 years ago by Andrey Semashev

(In [62450]) Refs #3876. Made format flags %T and %R to be processed by the library in order to support them on more platforms. Also marked some flags that are known to have similar problems in the docs.

comment:3 Changed 7 years ago by Andrey Semashev

Resolution: fixed
Status: newclosed

(In [62667]) Merged changes from trunk (rev. 62450). Fixes #3876.

comment:4 Changed 7 years ago by Andrey Semashev

(In [62669]) Merged changes from trunk (rev. 62450). Fixes #3876.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain az_sw_dude.
The resolution will be deleted.

Add Comment

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

Note: See TracTickets for help on using tickets.