Conversation
|
Thanks for the PR. Is this feature part of the standard? |
|
No, it is not in standard. The standard only supports the precision modifier for strings and floating point numbers. Precision available only for particular argument, but not for format-spec. |
vitaut
left a comment
There was a problem hiding this comment.
Thanks for the PR. Adding precision support to durations sounds reasonable but for consistency with the standard it should go at the beginning, not in %S (https://eel.is/c++draft/time.format), e.g.
fmt::print("{:.6%S}", std::chrono::nanoseconds{1234});
|
It is not obvious for user to use |
We should make existing precision apply to |
|
Oh, I squashed last commits to resolve conflict. It led to close this PR. @vitaut, please reopen it, I made changes. Now it should work. |
|
I am not able to reopen this diff for some reason. Please submit a new one. |
Add precision modifier for seconds in chrono format and test for it.
It's became important for custom datetime types that store date, time and subseconds. I want to use chrono format for those types, but I have no way to control subsecond precision.
Use case: