From 0c7beb2e36008598cf80d0e8eb8635ac403febb9 Mon Sep 17 00:00:00 2001 From: gabime Date: Tue, 2 Feb 2016 23:41:53 +0200 Subject: [PATCH] fixed issue #173 - timezone as output by %z option has a double negative sign --- include/spdlog/details/pattern_formatter_impl.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/spdlog/details/pattern_formatter_impl.h b/include/spdlog/details/pattern_formatter_impl.h index 9ae6b6d2..92ccc376 100644 --- a/include/spdlog/details/pattern_formatter_impl.h +++ b/include/spdlog/details/pattern_formatter_impl.h @@ -317,8 +317,10 @@ public: int h = total_minutes / 60; int m = total_minutes % 60; - char sign = h >= 0 ? '+' : '-'; - msg.formatted << sign; + if (h >= 0) //minus sign will be printed anyway if negative + { + msg.formatted << '+'; + } pad_n_join(msg.formatted, h, m, ':'); } private: @@ -481,7 +483,7 @@ inline void spdlog::pattern_formatter::handle_flag(char flag) { switch (flag) { - // logger name + // logger name case 'n': _formatters.push_back(std::unique_ptr(new details::name_formatter())); break;