1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // <chrono> 11 12 // duration 13 14 // template <class Rep1, class Period, class Rep2> 15 // constexpr 16 // duration<typename common_type<Rep1, Rep2>::type, Period> 17 // operator*(const duration<Rep1, Period>& d, const Rep2& s); 18 19 // template <class Rep1, class Period, class Rep2> 20 // constexpr 21 // duration<typename common_type<Rep1, Rep2>::type, Period> 22 // operator*(const Rep1& s, const duration<Rep2, Period>& d); 23 24 #include <chrono> 25 #include <cassert> 26 27 int main() 28 { 29 { 30 std::chrono::nanoseconds ns(3); 31 ns = ns * 5; 32 assert(ns.count() == 15); 33 ns = 6 * ns; 34 assert(ns.count() == 90); 35 } 36 #ifndef _LIBCPP_HAS_NO_CONSTEXPR 37 { 38 constexpr std::chrono::nanoseconds ns(3); 39 constexpr std::chrono::nanoseconds ns2 = ns * 5; 40 static_assert(ns2.count() == 15, ""); 41 constexpr std::chrono::nanoseconds ns3 = 6 * ns; 42 static_assert(ns3.count() == 18, ""); 43 } 44 #endif 45 } 46