-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 durations #3662
Comments
The definition of
but I think 01 is correct and libc++ which has a more complete
Thanks for fixing these.
Could you give an example illustrating what you mean by the natural format? |
When formatting |
It is an intriguing idea but I don't think we need a format specifier for this. You can create a custom formatter instead. |
https://godbolt.org/z/x5MfPr1KW
The doc says, that durations can be formatted.
However, it only specifies how 'q' 'Q' and 'j' behave (with 'j' not being implemented; see #3643)
If I format a duration of e.g., 25h with 'H'
fmt::format
gives 01std::format
gives 25What is supposed to happen?
Also, the new durations added in C++ 20 are seemingly not implemented in fmt.
fmt and std also use different suffixes for minutes.
On a more general note I would like to add, that within this standard durations can be formatted as either basically a time or in the lowest unit used. However, both feel very unnatural. Usually one would write durations using several as large as possible units.
Would it be possible to give durations more options and a natural default format?
The text was updated successfully, but these errors were encountered: