1bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//===----------------------------------------------------------------------===// 2bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant// 3f5256e16dfc425c1d466f6308d4026d529ce9e0bHoward Hinnant// The LLVM Compiler Infrastructure 4bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant// 5b64f8b07c104c6cc986570ac8ee0ed16a9f23976Howard Hinnant// This file is dual licensed under the MIT and the University of Illinois Open 6b64f8b07c104c6cc986570ac8ee0ed16a9f23976Howard Hinnant// Source Licenses. See LICENSE.TXT for details. 7bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant// 8bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//===----------------------------------------------------------------------===// 9bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 10bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant// <chrono> 11bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 12bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant// time_point 13bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 14c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant// template <class Clock, class Duration1, class Duration2> 15bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant// bool 16bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant// operator< (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs); 17bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 18c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant// template <class Clock, class Duration1, class Duration2> 19bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant// bool 20bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant// operator> (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs); 21bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 22c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant// template <class Clock, class Duration1, class Duration2> 23bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant// bool 24bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant// operator<=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs); 25bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 26c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant// template <class Clock, class Duration1, class Duration2> 27bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant// bool 28bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant// operator>=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs); 29bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 30bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#include <chrono> 31bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#include <cassert> 32bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 33e619862dbf0c4a46db6e3d816bcafcfef6e85977Stephan T. Lavavej#include "test_macros.h" 34e619862dbf0c4a46db6e3d816bcafcfef6e85977Stephan T. Lavavej 35bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnantint main() 36bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant{ 37bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant typedef std::chrono::system_clock Clock; 38bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant typedef std::chrono::milliseconds Duration1; 39bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant typedef std::chrono::microseconds Duration2; 40bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant typedef std::chrono::time_point<Clock, Duration1> T1; 41bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant typedef std::chrono::time_point<Clock, Duration2> T2; 42bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 43bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant { 44bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant T1 t1(Duration1(3)); 45bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant T1 t2(Duration1(3)); 46bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert(!(t1 < t2)); 47bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert(!(t1 > t2)); 48bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert( (t1 <= t2)); 49bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert( (t1 >= t2)); 50bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant } 51bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant { 52bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant T1 t1(Duration1(3)); 53bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant T1 t2(Duration1(4)); 54bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert( (t1 < t2)); 55bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert(!(t1 > t2)); 56bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert( (t1 <= t2)); 57bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert(!(t1 >= t2)); 58bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant } 59bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant { 60bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant T1 t1(Duration1(3)); 61bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant T2 t2(Duration2(3000)); 62bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert(!(t1 < t2)); 63bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert(!(t1 > t2)); 64bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert( (t1 <= t2)); 65bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert( (t1 >= t2)); 66bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant } 67bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant { 68bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant T1 t1(Duration1(3)); 69bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant T2 t2(Duration2(3001)); 70bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert( (t1 < t2)); 71bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert(!(t1 > t2)); 72bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert( (t1 <= t2)); 73bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert(!(t1 >= t2)); 74bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant } 75832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow 76e619862dbf0c4a46db6e3d816bcafcfef6e85977Stephan T. Lavavej#if TEST_STD_VER > 11 77832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow { 78832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow constexpr T1 t1(Duration1(3)); 79832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow constexpr T1 t2(Duration1(3)); 80832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert(!(t1 < t2), ""); 81832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert(!(t1 > t2), ""); 82832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert( (t1 <= t2), ""); 83832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert( (t1 >= t2), ""); 84832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow } 85832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow { 86832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow constexpr T1 t1(Duration1(3)); 87832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow constexpr T1 t2(Duration1(4)); 88832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert( (t1 < t2), ""); 89832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert(!(t1 > t2), ""); 90832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert( (t1 <= t2), ""); 91832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert(!(t1 >= t2), ""); 92832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow } 93832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow { 94832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow constexpr T1 t1(Duration1(3)); 95832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow constexpr T2 t2(Duration2(3000)); 96832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert(!(t1 < t2), ""); 97832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert(!(t1 > t2), ""); 98832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert( (t1 <= t2), ""); 99832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert( (t1 >= t2), ""); 100832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow } 101832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow { 102832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow constexpr T1 t1(Duration1(3)); 103832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow constexpr T2 t2(Duration2(3001)); 104832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert( (t1 < t2), ""); 105832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert(!(t1 > t2), ""); 106832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert( (t1 <= t2), ""); 107832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert(!(t1 >= t2), ""); 108832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow } 109832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow#endif 110bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant} 111