From e41100ccaeab0c6b27f12d74daf08816c1ddcacc Mon Sep 17 00:00:00 2001 From: Filip Brcic Date: Tue, 18 May 2021 21:46:57 +0200 Subject: [PATCH] Hopefully fixed template error on MSVC --- include/fmt/chrono.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/include/fmt/chrono.h b/include/fmt/chrono.h index 7e04e5d0..a8a619f7 100644 --- a/include/fmt/chrono.h +++ b/include/fmt/chrono.h @@ -405,13 +405,6 @@ inline size_t strftime(wchar_t* str, size_t count, const wchar_t* format, FMT_END_DETAIL_NAMESPACE -template ::min() < std::chrono::duration::zero()>> -constexpr std::chrono::duration abs(std::chrono::duration d) -{ - return d >= d.zero() ? d : -d; -} - template struct formatter>, Char> : formatter { @@ -421,7 +414,10 @@ struct formatter(epoch); - auto subseconds = abs(std::chrono::duration_cast>(epoch - seconds)); + // auto subseconds = abs(std::chrono::duration_cast>(epoch - seconds)); + auto subseconds = std::chrono::duration_cast>(epoch - seconds); + + if (subseconds < subseconds.zero()) subseconds = -subseconds; if (subseconds.count() > 0) { auto width = std::to_string(Period::den).size() - 1;