mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-29 18:27:40 +02:00
Fix MSVC warning in std::chrono::time_point formatter (#3475)
* Fix MSVC warning in std::chrono::time_point formatter The condition is constexpr causing MSVC level 4 warning: warning C4127: conditional expression is constant Changed the code to eliminate the warning * Use detail::const_check * Review: revert else condition --------- Co-authored-by: Hans-Martin B. Jensen <haje@eposaudio.com>
This commit is contained in:
committed by
GitHub
parent
686b3353aa
commit
8abfc145be
@ -2135,8 +2135,9 @@ struct formatter<std::chrono::time_point<std::chrono::system_clock, Duration>,
|
||||
auto format(std::chrono::time_point<std::chrono::system_clock, Duration> val,
|
||||
FormatContext& ctx) const -> decltype(ctx.out()) {
|
||||
using period = typename Duration::period;
|
||||
if (period::num != 1 || period::den != 1 ||
|
||||
std::is_floating_point<typename Duration::rep>::value) {
|
||||
if (detail::const_check(
|
||||
period::num != 1 || period::den != 1 ||
|
||||
std::is_floating_point<typename Duration::rep>::value)) {
|
||||
const auto epoch = val.time_since_epoch();
|
||||
auto subsecs = std::chrono::duration_cast<Duration>(
|
||||
epoch - std::chrono::duration_cast<std::chrono::seconds>(epoch));
|
||||
|
Reference in New Issue
Block a user