diff --git a/include/date/date.h b/include/date/date.h index 53c9bde..96cdc95 100644 --- a/include/date/date.h +++ b/include/date/date.h @@ -158,6 +158,17 @@ namespace date # undef sun #endif +// Work around for a NVCC compiler bug which causes it to fail +// to compile std::ratio_{multiply,divide} when used directly +// in the std::chrono::duration template instantiations below +namespace detail { +template +using ratio_multiply = decltype(std::ratio_multiply{}); + +template +using ratio_divide = decltype(std::ratio_divide{}); +} // namespace detail + //-----------+ // Interface | //-----------+ @@ -165,16 +176,16 @@ namespace date // durations using days = std::chrono::duration - , std::chrono::hours::period>::type>; + , std::chrono::hours::period>>; using weeks = std::chrono::duration - , days::period>::type>; + , days::period>>; using years = std::chrono::duration - , days::period>::type>; + , days::period>>; using months = std::chrono::duration - >::type>; + >>; // time_point diff --git a/include/date/islamic.h b/include/date/islamic.h index f87be18..82ed659 100644 --- a/include/date/islamic.h +++ b/include/date/islamic.h @@ -39,10 +39,10 @@ using days = date::days; using weeks = date::weeks; using years = std::chrono::duration - , days::period>>; + , days::period>>; using months = std::chrono::duration - >>; + >>; // time_point diff --git a/include/date/julian.h b/include/date/julian.h index cc2d1b0..7869792 100644 --- a/include/date/julian.h +++ b/include/date/julian.h @@ -39,10 +39,10 @@ using days = date::days; using weeks = date::weeks; using years = std::chrono::duration - , days::period>>; + , days::period>>; using months = std::chrono::duration - >>; + >>; // time_point diff --git a/test/date_test/detail/decimal_format_seconds.pass.cpp b/test/date_test/detail/decimal_format_seconds.pass.cpp index 9491b93..cce6ae8 100644 --- a/test/date_test/detail/decimal_format_seconds.pass.cpp +++ b/test/date_test/detail/decimal_format_seconds.pass.cpp @@ -55,12 +55,12 @@ #include using fortnights = std::chrono::duration, - date::weeks::period>>; + date::detail::ratio_multiply, + date::weeks::period>>; using microfortnights = std::chrono::duration>; + date::detail::ratio_multiply>; int main() diff --git a/test/date_test/format/range.pass.cpp b/test/date_test/format/range.pass.cpp index 054197a..fbe2d8c 100644 --- a/test/date_test/format/range.pass.cpp +++ b/test/date_test/format/range.pass.cpp @@ -27,12 +27,12 @@ #include using fortnights = std::chrono::duration, - date::weeks::period>>; + date::detail::ratio_multiply, + date::weeks::period>>; using microfortnights = std::chrono::duration>; + date::detail::ratio_multiply>; int main() diff --git a/test/date_test/multi_year_duration_addition.pass.cpp b/test/date_test/multi_year_duration_addition.pass.cpp index cbd548d..5d1d031 100644 --- a/test/date_test/multi_year_duration_addition.pass.cpp +++ b/test/date_test/multi_year_duration_addition.pass.cpp @@ -72,8 +72,8 @@ main() using namespace date; using namespace std::chrono; - using decades = duration, years::period>>; - using decamonths = duration, months::period>>; + using decades = duration, years::period>>; + using decamonths = duration, months::period>>; constexpr months one_month{1}; constexpr years one_year{1}; diff --git a/test/date_test/time_of_day_microfortnights.pass.cpp b/test/date_test/time_of_day_microfortnights.pass.cpp index 2a16e44..362c793 100644 --- a/test/date_test/time_of_day_microfortnights.pass.cpp +++ b/test/date_test/time_of_day_microfortnights.pass.cpp @@ -57,12 +57,12 @@ #include using fortnights = std::chrono::duration, - date::weeks::period>>; + date::detail::ratio_multiply, + date::weeks::period>>; using microfortnights = std::chrono::duration>; + date::detail::ratio_multiply>; int main()