-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
formatting chrono with precision #3219
Comments
Good catch(es), thanks. As usual, PRs are welcome =). |
Why is printing |
No, the first character of a chrono-spec must be |
If you want to write literal characters before the first % put them before the replacement field: |
The time point issue is fixed in #3232 (thanks @ShawnZhong) but precision of durations with integral representation is useful and will continue to be supported. |
Thanks for clarifying. I'm good with precision for integral durations. I have some follow-up comments/questions (which I can open a new issue if needed):
|
This seems pretty harmless and we can continue ignoring precision here (maybe even ignore in other cases).
I think |
The standard seems clear:
So %H uses the value of |
Also see the example in [time.format] p4. |
If we look at the standard spec, it's clear that using precision with a
duration
is only valid for floating point (https://eel.is/c++draft/time.format#1.sentence-4), so the second call there should be rejected.There's some ambiguity in the standard spec right now about what formatting a
time_point<system_clock, duration<int>>
with{:.2}
actually means (valid or not? probably not?) but either way, printing.2
in either case is definitely incorrect.The text was updated successfully, but these errors were encountered: