From fa894d7cbc7e27a64fa7e466fa56e718079da24c Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Thu, 21 Jan 2016 13:03:03 -0800 Subject: [core] Polyfill std::chrono::abs --- include/mbgl/util/chrono.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/mbgl/util/chrono.hpp') diff --git a/include/mbgl/util/chrono.hpp b/include/mbgl/util/chrono.hpp index dd228df977..219b827536 100644 --- a/include/mbgl/util/chrono.hpp +++ b/include/mbgl/util/chrono.hpp @@ -53,6 +53,14 @@ std::string iso8601(SystemTimePoint); SystemTimePoint parseTimePoint(const char *); +// C++17 polyfill +template ::min() < std::chrono::duration::zero()>> +constexpr std::chrono::duration abs(std::chrono::duration d) +{ + return d >= d.zero() ? d : -d; +} + } // namespace util } // namespace mbgl -- cgit v1.2.1