Remove floor, ceil, round and abs when VS Update 2 is present as it's chrono has this polishing.

This commit is contained in:
gm 2016-03-31 13:26:11 +13:00 committed by Howard Hinnant
parent cb33a27471
commit a093521890

27
date.h
View File

@ -887,6 +887,9 @@ trunc(const std::chrono::duration<Rep, Period>& d)
return To{detail::trunc(std::chrono::duration_cast<To>(d).count())};
}
// VS Update 2 provides floor, ceil, round, abs in chrono.
#if _MSC_FULL_VER < 190023918
// round down
template <class To, class Rep, class Period>
CONSTCD14
@ -949,17 +952,6 @@ abs(std::chrono::duration<Rep, Period> d)
return d >= d.zero() ? d : -d;
}
// trunc towards zero
template <class To, class Clock, class FromDuration>
CONSTCD11
inline
std::chrono::time_point<Clock, To>
trunc(const std::chrono::time_point<Clock, FromDuration>& tp)
{
using std::chrono::time_point;
return time_point<Clock, To>{trunc<To>(tp.time_since_epoch())};
}
// round down
template <class To, class Clock, class FromDuration>
CONSTCD11
@ -993,6 +985,19 @@ ceil(const std::chrono::time_point<Clock, FromDuration>& tp)
return time_point<Clock, To>{ceil<To>(tp.time_since_epoch())};
}
#endif // _MSC_FULL_VER < 190023918
// trunc towards zero
template <class To, class Clock, class FromDuration>
CONSTCD11
inline
std::chrono::time_point<Clock, To>
trunc(const std::chrono::time_point<Clock, FromDuration>& tp)
{
using std::chrono::time_point;
return time_point<Clock, To>{trunc<To>(tp.time_since_epoch())};
}
// day
CONSTCD11 inline day::day(unsigned d) NOEXCEPT : d_(static_cast<unsigned char>(d)) {}