Opened 12 years ago

Closed 9 years ago

#5041 closed Bugs (wontfix)

single digit year given when using %y in format string when stlport standard library in use

Reported by: crispin.boylan@… Owned by: az_sw_dude
Milestone: To Be Determined Component: date_time
Version: Boost 1.45.0 Severity: Problem
Keywords: Cc: cris@…

Description

I'm using solaris studio 12.2 on SPARC and boost 1.45.

When running a simple facet example I get a single digit year when the format string contains a %y and the year is less than 10.

ie the following simple program:

#include <boost/date_time/gregorian/gregorian.hpp>

int main() {

boost::gregorian::date localDate(2006,1,9); std::ostringstream ostr;

static std::locale locsmlocdmy(std::locale::classic(), new boost::gregorian::date_facet("%d%m%y"));

ostr.imbue(locsmlocdmy); ostr << localDate;

std::cout << ostr.str() << std::endl;

}

gives 09016 instead of 090106.

the same thing happens when using a ptime and a time_facet.

i also had an old boost version kicking around (1.33.1) and this exhibited the same problem!

Change History (7)

comment:1 by cris@…, 12 years ago

Cc: cris@… added

comment:2 by crispin.boylan@…, 12 years ago

i've tracked this down to an stlport bug. it seems that no leading 0's are appended on %y, %W and %j which is contrary to what strftime would produce.

this bug exists in the version of stlport shipped with Solaris Studio 12.2 (4.2.3). It is not fixed in the latest stlport version either from the looks of the code.

should this be worked around for stlport users?

comment:3 by crispin.boylan@…, 12 years ago

sorry, forgot to mention its actually the time_put facet which is at fault here.

the offending code is in time_facets.cpp the method write_formatted_timeT

comment:4 by crispin.boylan@…, 12 years ago

this is actually an stlport bug, existing in all released versions (but partially fixed in the unreleased git version).

the solaris compiler bug is:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7011081

the stlport bug is:

http://sourceforge.net/tracker/index.php?func=detail&aid=3154701&group_id=146814&atid=766244

comment:5 by crispin.boylan@…, 12 years ago

Summary: single digit year given when using %y in format string on solaris studiosingle digit year given when using %y in format string when stlport standard library in use

comment:6 by acharles, 9 years ago

Fix in develop.

comment:7 by Marshall Clow, 9 years ago

Resolution: wontfix
Status: newclosed

Closing this bug. What acharles meant by "fixed in develop" was that we added a test for %y with a year < 10 to the test suite.

This is really a STLPort bug; but there may never be another release of STLPort.

Note: See TracTickets for help on using tickets.