Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs for chrono type S decimal point locale does not match code #4117

Closed
tearfur opened this issue Aug 13, 2024 · 5 comments
Closed

Docs for chrono type S decimal point locale does not match code #4117

tearfur opened this issue Aug 13, 2024 · 5 comments

Comments

@tearfur
Copy link

tearfur commented Aug 13, 2024

The decimal point character for the chrono type 'S' seems to be locale-independent, contrary to what the docs says. Reproduced at https://godbolt.org/z/TKxcq5hf6.

From the docs:

The character for the decimal point is localized according to the locale. The modified command %OS produces the locale's alternative representation.

Relevant code (I think):

*out++ = '.';

*out++ = '.';

fmt::format_to(std::back_inserter(buf), FMT_STRING("{:.{}f}"),

@tearfur
Copy link
Author

tearfur commented Aug 13, 2024

I wonder if I missed something, std::format behaves the same way too... https://godbolt.org/z/Ynd7P4ETM

@smarthyen
Copy link

I just ran into the same Issue:
https://godbolt.org/z/ansPYErn8
And came to the same conclusion, looking at the source.

Although I'm not sure whether "{:%S}" and "{:L%S}" should behave the same.

@vitaut
Copy link
Contributor

vitaut commented Aug 13, 2024

%S is locale-independent by default. We should update the docs.

@tearfur
Copy link
Author

tearfur commented Aug 13, 2024

Relevant material: https://wg21.link/P2372R3

@vitaut
Copy link
Contributor

vitaut commented Aug 18, 2024

Fixed in 589898e. Thanks for reporting.

@vitaut vitaut closed this as completed Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants