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