diff --git a/date.h b/date.h index 67d2f73..4489f4f 100644 --- a/date.h +++ b/date.h @@ -1069,7 +1069,7 @@ std::chrono::time_point floor(const std::chrono::time_point& tp) { using std::chrono::time_point; - return time_point{floor(tp.time_since_epoch())}; + return time_point{date::floor(tp.time_since_epoch())}; } // round to nearest, to even on tie @@ -4156,7 +4156,7 @@ typename std::enable_if >::type operator<<(std::basic_ostream& os, const sys_time& tp) { - auto const dp = floor(tp); + auto const dp = date::floor(tp); return os << year_month_day(dp) << ' ' << make_time(tp-dp); } @@ -4173,7 +4173,7 @@ inline std::basic_ostream& operator<<(std::basic_ostream& os, const local_time& ut) { - return os << sys_time{ut.time_since_epoch()}; + return (os << sys_time{ut.time_since_epoch()}); } // to_stream @@ -4951,7 +4951,7 @@ to_stream(std::basic_ostream& os, const CharT* fmt, throw std::runtime_error("Can not format %z with unknown offset"); auto m = duration_cast(*offset_sec); auto neg = m < minutes{0}; - m = abs(m); + m = date::abs(m); auto h = duration_cast(m); m -= h; if (neg) diff --git a/tz.cpp b/tz.cpp index eff28d5..be3df40 100644 --- a/tz.cpp +++ b/tz.cpp @@ -104,6 +104,11 @@ #ifdef _WIN32 # include // _unlink etc. + +# if defined(__clang__) + struct IUnknown; // fix for issue with static_cast<> in objbase.h (see https://github.com/philsquared/Catch/issues/690) +# endif + # include // CoTaskFree, ShGetKnownFolderPath etc. # if HAS_REMOTE_API # include // _mkdir @@ -654,7 +659,7 @@ detail::MonthDayTime::MonthDayTime(local_seconds tp, tz timezone) : zone_(timezone) { using namespace date; - const auto dp = floor(tp); + const auto dp = date::floor(tp); const auto hms = make_time(tp - dp); const auto ymd = year_month_day(dp); u = ymd.month() / ymd.day(); @@ -1827,14 +1832,14 @@ format_abbrev(std::string format, const std::string& variable, std::chrono::seco } else temp = '+'; - auto h = floor(off); + auto h = date::floor(off); off -= h; if (h < hours{10}) temp += '0'; temp += std::to_string(h.count()); if (off > seconds{0}) { - auto m = floor(off); + auto m = date::floor(off); off -= m; if (m < minutes{10}) temp += '0'; @@ -1891,7 +1896,7 @@ time_zone::get_info_impl(sys_seconds tp, int tz_int) const using namespace date; tz timezone = static_cast(tz_int); assert(timezone != tz::standard); - auto y = year_month_day(floor(tp)).year(); + auto y = year_month_day(date::floor(tp)).year(); if (y < min_year || y > max_year) throw std::runtime_error("The year " + std::to_string(static_cast(y)) + " is out of range:[" + std::to_string(static_cast(min_year)) + ", " diff --git a/tz.h b/tz.h index 1093e6a..39f8baf 100644 --- a/tz.h +++ b/tz.h @@ -448,7 +448,7 @@ sys_info time_zone::get_info(sys_time st) const { using namespace std::chrono; - return get_info_impl(floor(st)); + return get_info_impl(date::floor(st)); } template @@ -457,7 +457,7 @@ local_info time_zone::get_info(local_time tp) const { using namespace std::chrono; - return get_info_impl(floor(tp)); + return get_info_impl(date::floor(tp)); } template