[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / time / time.point / time.point.nonmember / op_-duration.pass.cpp
blob199bdec66878a2a144c7bf720426015c26ea8001
1 //===----------------------------------------------------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
9 // "unable to find library from dependent library specifier: rt"
10 // XFAIL: LIBCXX-PICOLIBC-FIXME
12 // <chrono>
14 // time_point
16 // template <class Clock, class Duration1, class Rep2, class Period2>
17 // time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
18 // operator-(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
20 #include <chrono>
21 #include <cassert>
22 #include <cstdint>
24 #include "test_macros.h"
26 template <class D>
27 void test2739() // LWG2739
29 typedef std::chrono::time_point<std::chrono::system_clock> TimePoint;
30 typedef std::chrono::duration<D> Dur;
31 const Dur d(5);
32 TimePoint t0 = std::chrono::system_clock::from_time_t(200);
33 TimePoint t1 = t0 - d;
34 assert(t1 < t0);
37 int main(int, char**)
39 typedef std::chrono::system_clock Clock;
40 typedef std::chrono::milliseconds Duration1;
41 typedef std::chrono::microseconds Duration2;
43 std::chrono::time_point<Clock, Duration1> t1(Duration1(3));
44 std::chrono::time_point<Clock, Duration2> t2 = t1 - Duration2(5);
45 assert(t2.time_since_epoch() == Duration2(2995));
47 #if TEST_STD_VER > 11
49 constexpr std::chrono::time_point<Clock, Duration1> t1(Duration1(3));
50 constexpr std::chrono::time_point<Clock, Duration2> t2 = t1 - Duration2(5);
51 static_assert(t2.time_since_epoch() == Duration2(2995), "");
53 #endif
54 test2739<std::int32_t>();
55 test2739<std::uint32_t>();
57 return 0;