• 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 
11 // UNSUPPORTED: c++98, c++03, c++11
12 #include <chrono>
13 #include <cassert>
14 
main()15 int main()
16 {
17     using namespace std::chrono;
18 
19     hours h = 4h;
20     assert ( h == hours(4));
21     auto h2 = 4.0h;
22     assert ( h == h2 );
23 
24     minutes min = 36min;
25     assert ( min == minutes(36));
26     auto min2 = 36.0min;
27     assert ( min == min2 );
28 
29     seconds s = 24s;
30     assert ( s == seconds(24));
31     auto s2 = 24.0s;
32     assert ( s == s2 );
33 
34     milliseconds ms = 247ms;
35     assert ( ms == milliseconds(247));
36     auto ms2 = 247.0ms;
37     assert ( ms == ms2 );
38 
39     microseconds us = 867us;
40     assert ( us == microseconds(867));
41     auto us2 = 867.0us;
42     assert ( us == us2 );
43 
44     nanoseconds ns = 645ns;
45     assert ( ns == nanoseconds(645));
46     auto ns2 = 645.ns;
47     assert ( ns == ns2 );
48 }
49