From 645c76a9a5d20ddb6c33b42a0a62e38df26a1cc3 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 25 Nov 2018 15:33:28 -0800 Subject: [PATCH] Fix dummy warnings --- include/fmt/time.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/include/fmt/time.h b/include/fmt/time.h index e837a885..c5bacfe4 100644 --- a/include/fmt/time.h +++ b/include/fmt/time.h @@ -56,11 +56,10 @@ inline std::tm localtime(std::time_t time) { #endif }; dispatcher lt(time); - if (lt.run()) - return lt.tm_; // Too big time values may be unsupported. - FMT_THROW(format_error("time_t value out of range")); - return {}; + if (!lt.run()) + FMT_THROW(format_error("time_t value out of range")); + return lt.tm_; } // Thread-safe replacement for std::gmtime @@ -94,11 +93,10 @@ inline std::tm gmtime(std::time_t time) { #endif }; dispatcher gt(time); - if (gt.run()) - return gt.tm_; // Too big time values may be unsupported. - FMT_THROW(format_error("time_t value out of range")); - return {}; + if (!gt.run()) + FMT_THROW(format_error("time_t value out of range")); + return gt.tm_; } namespace internal {