diff --git a/include/EASTL/chrono.h b/include/EASTL/chrono.h index 024e8098..18bfd355 100644 --- a/include/EASTL/chrono.h +++ b/include/EASTL/chrono.h @@ -327,7 +327,12 @@ namespace chrono } template - duration::type, Period1> EASTL_FORCE_INLINE + duration< + typename eastl::common_type< + Rep1, + typename eastl::enable_if::value, Rep2>::type + >::type, + Period1> EASTL_FORCE_INLINE operator/(const duration& lhs, const Rep2& rhs) { typedef duration::type, Period1> common_duration_t; @@ -335,15 +340,20 @@ namespace chrono } template - typename eastl::common_type, duration>::type EASTL_FORCE_INLINE + typename eastl::common_type::type EASTL_FORCE_INLINE operator/(const duration& lhs, const duration& rhs) { typedef typename eastl::common_type, duration>::type common_duration_t; - return common_duration_t(common_duration_t(lhs).count() / common_duration_t(rhs).count()); + return common_duration_t(lhs).count() / common_duration_t(rhs).count(); } template - duration::type, Period1> EASTL_FORCE_INLINE + duration< + typename eastl::common_type< + Rep1, + typename eastl::enable_if::value, Rep2>::type + >::type, + Period1> EASTL_FORCE_INLINE operator%(const duration& lhs, const Rep2& rhs) { typedef duration::type, Period1> common_duration_t; diff --git a/test/source/TestChrono.cpp b/test/source/TestChrono.cpp index a56b9343..9340d800 100644 --- a/test/source/TestChrono.cpp +++ b/test/source/TestChrono.cpp @@ -101,6 +101,13 @@ int TestDuration() } } + { + seconds s(5); + milliseconds ms(10); + VERIFY(s / ms == 500); + VERIFY(ms / s.count() == milliseconds(2)); + } + return nErrorCount; }