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 #include "test_macros.h"
28
main()29 int main()
30 {
31 {
32 std::chrono::nanoseconds ns(3);
33 ns = ns * 5;
34 assert(ns.count() == 15);
35 ns = 6 * ns;
36 assert(ns.count() == 90);
37 }
38 #if TEST_STD_VER >= 11
39 {
40 constexpr std::chrono::nanoseconds ns(3);
41 constexpr std::chrono::nanoseconds ns2 = ns * 5;
42 static_assert(ns2.count() == 15, "");
43 constexpr std::chrono::nanoseconds ns3 = 6 * ns;
44 static_assert(ns3.count() == 18, "");
45 }
46 #endif
47 }
48