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)) {}