• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
3 //
4 //                     The LLVM Compiler Infrastructure
5 //
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10 #include <chrono>
11 #include <cassert>
12 
main()13 int main()
14 {
15 #if _LIBCPP_STD_VER > 11
16     using namespace std::chrono;
17 
18     hours h = 4h;
19     assert ( h == hours(4));
20     auto h2 = 4.0h;
21     assert ( h == h2 );
22 
23     minutes min = 36min;
24     assert ( min == minutes(36));
25     auto min2 = 36.0min;
26     assert ( min == min2 );
27 
28     seconds s = 24s;
29     assert ( s == seconds(24));
30     auto s2 = 24.0s;
31     assert ( s == s2 );
32 
33     milliseconds ms = 247ms;
34     assert ( ms == milliseconds(247));
35     auto ms2 = 247.0ms;
36     assert ( ms == ms2 );
37 
38     microseconds us = 867us;
39     assert ( us == microseconds(867));
40     auto us2 = 867.0us;
41     assert ( us == us2 );
42 
43     nanoseconds ns = 645ns;
44     assert ( ns == nanoseconds(645));
45     auto ns2 = 645.ns;
46     assert ( ns == ns2 );
47 #endif
48 }
49