• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 //===----------------------------------------------------------------------===//
8 //
9 // UNSUPPORTED: libcpp-has-no-monotonic-clock
10 
11 // Due to C++17 inline variables ASAN flags this test as containing an ODR
12 // violation because Clock::is_steady is defined in both the dylib and this TU.
13 // UNSUPPORTED: asan
14 
15 // <chrono>
16 
17 // steady_clock
18 
19 // check clock invariants
20 
21 #include <chrono>
22 
23 #include "test_macros.h"
24 
25 template <class T>
test(const T &)26 void test(const T &) {}
27 
main(int,char **)28 int main(int, char**)
29 {
30     typedef std::chrono::steady_clock C;
31     static_assert((std::is_same<C::rep, C::duration::rep>::value), "");
32     static_assert((std::is_same<C::period, C::duration::period>::value), "");
33     static_assert((std::is_same<C::duration, C::time_point::duration>::value), "");
34     static_assert(C::is_steady, "");
35     test(std::chrono::steady_clock::is_steady);
36 
37   return 0;
38 }
39