Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-535

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 4.1.2, 4.1.3, 4.1.4
    • 4.3.0
    • 22. Localization
    • None
    • Incorrect Behavior

    Description

      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

      Attachments

        Activity

          People

            sebor Martin Sebor
            vitek Travis Vitek
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 4h
                4h
                Remaining:
                Remaining Estimate - 4h
                4h
                Logged:
                Time Spent - Not Specified
                Not Specified