Closed tomaszkam closed 5 years ago
@HowardHinnant As far I understand this could be potentially handled as an extension post C++20 - adding this specifier would not be breaking.
Actually we need these now because strftime
has them, and we can copy that:
%EY is replaced by the locale’s full alternative year representation. %Ey is replaced by the offset from %EC (year only) in the locale’s alternative representation. %Oy is replaced by the last 2 digits of the year, using the locale’s alternative numeric symbols.
Same as for the other issue, how we would present it as issue, not new design (extension)? I think in this case, we call constiency with strftime
.
Discussion:
The year format specifier ('y', 'Y') are missing the locale alternative version ('%EY', '%Ey' and '%Oy'). That makes it inconsistent with the POSIX strftime
specification (per http://pubs.opengroup.org/onlinepubs/009695399/functions/strftime.html):
%Ey Replaced by the offset from %EC (year only) in the locale's alternative representation. %EY Replaced by the full alternative year representation. %Oy Replaced by the year (offset from %C ) using the locale's alternative numeric symbols.
and parse
specifiers (http://eel.is/c++draft/time.parse) that accepts these modified command.
Drafting note:
For the '%Oy' specifier we preserve consistency with the current specification for '%Od' and '%Oe' from
"Meaning of format
conversion specifier" (http://eel.is/c++draft/time.format#tab:time.format.spec):
The modified command
%Od
produces the locale's alternative representation. The modified command%Oe
produces the locale's alternative representation.
, as their corresponding POSIX specification is matching one for %Oy
:
%Od Replaced by the day of the month, using the locale's alternative numeric symbols, filled as needed with leading zeros if there is any alternative symbol for zero; otherwise, with leading spaces. %Oe Replaced by the day of the month, using the locale's alternative numeric symbols, filled as needed with leading spaces.
Proposed wording:
Change the '%y' entry in the "Table 87 — Meaning of format
flags" as follows:
The last two decimal digits of the year. If the result is a single digit it is prefixed by 0.
The modified command %Oy
produces the locale's alternative representation.
The modified command %Ey
produces the locale’s alternative representation of offset from %EC
(year only).
Change the '%Y' entry in the "Table 87 — Meaning of format
flags" as follows:
The year as a decimal number.
If the result is less than four digits it is left-padded with 0
to four digits.
The modified command %EY
produces the locale's alternative full year representation.
Original message: