From 1a940399c99b27e74421bb80df3c2d17c69c9111 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Tue, 4 Apr 2023 14:28:38 +0200 Subject: [PATCH] refactor: `chrono` types now convert to quantity kinds --- src/utility/include/mp_units/chrono.h | 4 ++-- test/unit_test/static/chrono_test.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/utility/include/mp_units/chrono.h b/src/utility/include/mp_units/chrono.h index 18485c60..63925d14 100644 --- a/src/utility/include/mp_units/chrono.h +++ b/src/utility/include/mp_units/chrono.h @@ -60,7 +60,7 @@ template template struct quantity_like_traits> { - static constexpr auto reference = isq::duration[detail::time_unit_from_chrono_period()]; + static constexpr auto reference = detail::time_unit_from_chrono_period(); using rep = Rep; [[nodiscard]] static constexpr rep number(const std::chrono::duration& q) { return q.count(); } }; @@ -75,7 +75,7 @@ inline constexpr chrono_point_origin_ chrono_point_origin; template struct quantity_point_like_traits>> { - static constexpr auto reference = isq::time[detail::time_unit_from_chrono_period()]; + static constexpr auto reference = detail::time_unit_from_chrono_period(); static constexpr auto point_origin = chrono_point_origin; using rep = Rep; [[nodiscard]] static constexpr auto relative(const std::chrono::time_point>& qp) diff --git a/test/unit_test/static/chrono_test.cpp b/test/unit_test/static/chrono_test.cpp index 6886dc24..cbdd5d32 100644 --- a/test/unit_test/static/chrono_test.cpp +++ b/test/unit_test/static/chrono_test.cpp @@ -37,7 +37,7 @@ using sys_days = std::chrono::time_point, std::chrono::hours::period>>>; template -using time_point = quantity_point, Rep>; +using time_point = quantity_point, Rep>; static_assert(QuantityLike); static_assert(QuantityPointLike); @@ -82,8 +82,8 @@ static_assert(!std::convertible_to>); -static_assert(is_of_type>); +static_assert(is_of_type>); +static_assert(is_of_type>); static_assert( is_of_type>); static_assert(is_of_type