From 3d291f48faebc8826b689299a7abcab1714cb8ee Mon Sep 17 00:00:00 2001 From: Andre Haupt Date: Fri, 7 Nov 2014 10:10:00 +0100 Subject: [PATCH] use std::abs from cstdlib which fixes a warning that occurs when compiling with clang 3.5 on 64-bit linux in file included from ../include/spdlog/sinks/../formatter.h:57: ../include/spdlog/details/pattern_formatter_impl.h:308:26: warning: absolute value function 'abs' given an argument of type 'rep' (aka 'long') but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value] auto secs_diff = abs((duration_cast(diff)).count()); ^ ../include/spdlog/details/pattern_formatter_impl.h:308:26: note: use function 'std::abs' instead auto secs_diff = abs((duration_cast(diff)).count()); ^~~ std::abs 1 warning generated. --- include/spdlog/details/pattern_formatter_impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/spdlog/details/pattern_formatter_impl.h b/include/spdlog/details/pattern_formatter_impl.h index 9e7ef474..aaf4b137 100644 --- a/include/spdlog/details/pattern_formatter_impl.h +++ b/include/spdlog/details/pattern_formatter_impl.h @@ -305,7 +305,7 @@ public: std::lock_guard l(_mutex); using namespace std::chrono; auto diff = msg.time - _last_update; - auto secs_diff = abs((duration_cast(diff)).count()); + auto secs_diff = std::abs((duration_cast(diff)).count()); if (secs_diff >= 2) { _value = get_value(msg);