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 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: no-threads
13 // template <class Clock, class Duration>
14 // void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
21 #include "test_macros.h"
25 typedef std::chrono::system_clock Clock
;
26 typedef Clock::time_point time_point
;
27 std::chrono::milliseconds
ms(500);
28 time_point t0
= Clock::now();
29 std::this_thread::sleep_until(t0
+ ms
);
30 time_point t1
= Clock::now();
31 // NOTE: Operating systems are (by default) best effort and therefore we may
32 // have slept longer, perhaps much longer than we requested.
33 assert(t1
- t0
>= ms
);