Issue Details (XML | Word | Printable)

Key: STDCXX-535
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Martin Sebor
Reporter: Travis Vitek
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
C++ Standard Library

std::time_put can generate output that is not parseable by std::time_get facet

Created: 23/Aug/07 11:58 PM   Updated: 06/Apr/08 10:59 PM
Return to search
Component/s: 22. Localization
Affects Version/s: 4.1.2, 4.1.3, 4.1.4
Fix Version/s: 4.3.0

Time Tracking:
Original Estimate: 4h
Original Estimate - 4h
Remaining Estimate: 4h
Remaining Estimate - 4h
Time Spent: Not Specified
Remaining Estimate - 4h

Severity: Incorrect Behavior


 Description  « Hide
std::time_get<>::get_date() is required to be able to parse the output produced by std::time_put<>::put(..., 'x'). For some locales, the '%x' format specifier expands out to '%e.%m.%Y'. When a date is formatted using this, there will be a leading space, and that leading space causes the time_get<>::get_date() operation to fail.

The root of the problem is that the POSIX strftime() function [which we emulate in time_get] requires that the '%e' specifier generate whitespace for single digit monthdays, and the POSIX strptime() function says that the number may be padded on the left with 0s. It does not appear to specify that whitespace is allowed. The strptime() implementation on some platforms [sun, linux, compaq, aix] allow this whitespace, while others [hp, freebsd] do not.

Discussion here.
http://mail-archives.apache.org/mod_mbox/incubator-stdcxx-dev/200708.mbox/%3c46CC8D6C.9000007@roguewave.com%3e



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Martin Sebor added a comment - 24/Aug/07 12:39 AM
Here's a link to the same discussion in a more user-friendly archive:
http://www.mail-archive.com/stdcxx-dev@incubator.apache.org/msg04356.html

And a link to the Austin Group thread where I'm attempting to get an interpretation of the POSIX spec:
https://www.opengroup.org/sophocles/show_archive.tpl?source=L&listname=austin-group-l&first=1&pagesize=80&searchstring=strptime%28%29+and+leading+space&zone=G


Travis Vitek added a comment - 06/Sep/07 07:27 PM
Corrected locale facet name to time_get.

Martin Sebor added a comment - 06/Apr/08 10:59 PM
Sounds like POSIX doesn't intend for strftime() to produce output that's not parseable by strptime() in this case. We need to file an Aardvark with POSIX and tweak our code to conform to the intended POSIX behavior.

Scheduled for 4.3.