1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
13 // template <class Clock, class Duration1, class Duration2>
14 // typename common_type<Duration1, Duration2>::type
15 // operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
20 #include "test_macros.h"
24 typedef std::chrono::system_clock Clock
;
25 typedef std::chrono::milliseconds Duration1
;
26 typedef std::chrono::microseconds Duration2
;
28 std::chrono::time_point
<Clock
, Duration1
> t1(Duration1(3));
29 std::chrono::time_point
<Clock
, Duration2
> t2(Duration2(5));
30 assert((t1
- t2
) == Duration2(2995));
34 constexpr std::chrono::time_point
<Clock
, Duration1
> t1(Duration1(3));
35 constexpr std::chrono::time_point
<Clock
, Duration2
> t2(Duration2(5));
36 static_assert((t1
- t2
) == Duration2(2995), "");