We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hello
I think this is a regression (judging by #1004 and #1012).
#include <fmt/chrono.h> int main(int argc, char* argv[]) { std::chrono::duration<double, std::nano> a { 46.666667 }; fmt::print("{}\n", a); fmt::print("{:.0}\n", a); fmt::print("{:.1}\n", a); fmt::print("{:.2}\n", a); fmt::print("{:.0%Q}\n", a); // Workaround fmt::print("{:.0f}{:%q}\n", a.count(), a); }
With v8.0.1 (https://godbolt.org/z/jMe7hGW6M):
46.6667ns 50ns 46.7ns 46.67ns 50 47ns
With 7.1.3 (https://godbolt.org/z/1WxxfhKd4) things are saner:
46.6667ns 47ns 46.7ns 46.67ns 47 47ns
If it should work, maybe test/chrono-test.cc needs a 0 dp test?
test/chrono-test.cc
Thanks
The text was updated successfully, but these errors were encountered:
Looks like the problem is that
fmt/include/fmt/chrono.h
Line 926 in e67f92c
incorrectly uses 0 to denote "no precision". A PR to fix this would be welcome.
Sorry, something went wrong.
Well I don't know enough about the code to know if it's correct, but here's an attempt: #2588
Added a few more tests for rounding and precision 0 and they all pass, though maybe more could be added.
HTH
No branches or pull requests
Hello
I think this is a regression (judging by #1004 and #1012).
With v8.0.1 (https://godbolt.org/z/jMe7hGW6M):
With 7.1.3 (https://godbolt.org/z/1WxxfhKd4) things are saner:
If it should work, maybe
test/chrono-test.cc
needs a 0 dp test?Thanks
The text was updated successfully, but these errors were encountered: