Title
Parse locale's aware modifiers for commands are not consistent with POSIX spec
Status
c++20
Section
[time.parse]
Submitter
Tomasz Kamiński

Created on 2019-08-06.00:00:00 last changed 45 months ago

Messages

Date: 2020-02-13.12:32:11

Proposed resolution:

This wording is relative to N4830.

  1. Modify Table 99 "Meaning of parse flags [tab:time.parse.spec]" in [time.parse] as indicated:

    Table 99: Meaning of parse flags [tab:time.parse.spec]
    Flag Parsed value
    […]
    %C The century as a decimal number. The modified command %NC 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 commands %EC and %OC interprets the locale's alternative representation of the century.
    […]
    %I The hour (12-hour clock) as a decimal number. The modified command %NI 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 %OI interprets the locale's alternative representation.
    […]
    %u The ISO weekday as a decimal number (1-7), where Monday is 1. The modified command %Nu specifies the maximum number of characters to read. If N is not specified, the default is 1. Leading zeroes are permitted but not required. The modified command %Ou interprets the locale's alternative representation.
    %U The week number of the year as a decimal number. The first Sunday of the year is the first day of week 01. Days of the same year prior to that are in week 00. The modified command %NU 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 %OU interprets the locale's alternative representation.
    […]
    %W The week number of the year as a decimal number. The first Monday of the year is the first day of week 01. Days of the same year prior to that are in week 00. The modified command %NW 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 %OW interprets the locale's alternative representation.
    […]
Date: 2020-02-13.12:32:11

[ 2020-02 Status to Immediate on Thursday morning in Prague. ]

Date: 2019-08-06.00:00:00

The current specification of the locale modifiers for the parse flags in "[tab:time.parse.spec] Meaning of parse flags" is inconsistent with the POSIX strptime specification:

  • New flags %OC, %Ou are added

  • Flags %OI, %OU, %OW are missing

Per Howard's comment:

I only invented in a couple places for these flags, and none of them involved locale-dependent stuff. If we are inconsistent with POSIX/C on this, it's a bug. Rationale, std::get_time is already specified in terms of strptime, and we can't afford to be inventive with locale-dependent things.

Note that, due above, the inconsistency between POSIX strftime specification that supports %Ou and %OV that are not handled by strptime should be (by design) reflected in "[tab:time.format.spec] Meaning of conversion specifiers" and "[tab:time.parse.spec] Meaning of parse flags" tables.

The %d modifier was addressed by LWG 3218.

History
Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2020-02-24 16:02:59adminsetstatus: immediate -> wp
2020-02-13 12:32:11adminsetmessages: + msg11060
2020-02-13 12:32:11adminsetstatus: new -> immediate
2019-08-15 18:52:44adminsetmessages: + msg10551
2019-08-06 00:00:00admincreate