From a093521890c7de705b645a8b5bc7ea76050565a7 Mon Sep 17 00:00:00 2001 From: gm Date: Thu, 31 Mar 2016 13:26:11 +1300 Subject: [PATCH] Remove floor, ceil, round and abs when VS Update 2 is present as it's chrono has this polishing. --- date.h | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/date.h b/date.h index 987e41b..a0870ed 100644 --- a/date.h +++ b/date.h @@ -887,6 +887,9 @@ trunc(const std::chrono::duration& d) return To{detail::trunc(std::chrono::duration_cast(d).count())}; } +// VS Update 2 provides floor, ceil, round, abs in chrono. +#if _MSC_FULL_VER < 190023918 + // round down template CONSTCD14 @@ -949,17 +952,6 @@ abs(std::chrono::duration d) return d >= d.zero() ? d : -d; } -// trunc towards zero -template -CONSTCD11 -inline -std::chrono::time_point -trunc(const std::chrono::time_point& tp) -{ - using std::chrono::time_point; - return time_point{trunc(tp.time_since_epoch())}; -} - // round down template CONSTCD11 @@ -993,6 +985,19 @@ ceil(const std::chrono::time_point& tp) return time_point{ceil(tp.time_since_epoch())}; } +#endif // _MSC_FULL_VER < 190023918 + +// trunc towards zero +template +CONSTCD11 +inline +std::chrono::time_point +trunc(const std::chrono::time_point& tp) +{ + using std::chrono::time_point; + return time_point{trunc(tp.time_since_epoch())}; +} + // day CONSTCD11 inline day::day(unsigned d) NOEXCEPT : d_(static_cast(d)) {}