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

Fix for issue #3228 #3229

Merged
merged 1 commit into from
Dec 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/fmt/chrono.h
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ void write_fractional_seconds(OutputIt& out, Duration d, int precision = -1) {
auto n = static_cast<uint32_or_64_or_128_t<long long>>(subseconds);
const int num_digits = detail::count_digits(n);

int leading_zeroes = std::max(0, num_fractional_digits - num_digits);
int leading_zeroes = (std::max)(0, num_fractional_digits - num_digits);
if (precision < 0) {
FMT_ASSERT(!std::is_floating_point<typename Duration::rep>::value, "");
if (std::ratio_less<typename subsecond_precision::period,
Expand All @@ -1064,7 +1064,7 @@ void write_fractional_seconds(OutputIt& out, Duration d, int precision = -1) {
}
} else {
*out++ = '.';
leading_zeroes = std::min(leading_zeroes, precision);
leading_zeroes = (std::min)(leading_zeroes, precision);
out = std::fill_n(out, leading_zeroes, '0');
int remaining = precision - leading_zeroes;
if (remaining != 0 && remaining < num_digits) {
Expand Down