This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.

3218. Modifier for %d parse flag does not match POSIX and format specification

Section: 29.13 [time.parse] Status: C++20 Submitter: Tomasz Kamiński Opened: 2019-06-13 Last modified: 2021-02-25

Priority: 0

View other active issues in [time.parse].

View all other issues in [time.parse].

View all issues with C++20 status.

Discussion:

Currently, the '%d' parse flags accepts the 'E' modifier to parse the locale's alternative representation, see Table 88 — "Meaning of parse flags":

The modified command %Ed interprets the locale's alternative representation of the day of the month.

This is inconsistent with the POSIX strftime specification and the format functions, that uses 'O' to output alternate locale representation. Per Table 87 — "Meaning of format conversion specifiers":

The modified command %Od produces the locale's alternative representation.

[2019-06-24; Howard comments]

This was simply a type-o in my documentation that infected the proposal and subsequently the C++ working draft.

None of std::time_put, C's strftime, or POSIX's strftime support %Ed but all support %Od. Furthermore the existing example implementation supports %Od but not %Ed. And all the existing example implementation does is forward to std::time_put.

[2019-07 Issue Prioritization]

Status to Tentatively Ready after five positive votes on the reflector.

Proposed resolution:

This wording is relative to N4810.

  1. Modify 29.13 [time.parse], Table 88 — "Meaning of parse flags", as indicated:

    Table 88 — Meaning of parse flags
    Flag Parsed value
    […]
    %d The day of the month as a decimal number. The modified command %Nd specifies the maximum number of characters to read. If N is not specified, the default is 2. Leading zeroes are permitted but not required. The modified command %EOd interprets the locale's alternative representation of the day of the month.
    […]