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 33bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnantint main() 34bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant{ 35bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant typedef std::chrono::system_clock Clock; 36bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant typedef std::chrono::milliseconds Duration1; 37bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant typedef std::chrono::microseconds Duration2; 38bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant typedef std::chrono::time_point<Clock, Duration1> T1; 39bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant typedef std::chrono::time_point<Clock, Duration2> T2; 40bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant 41bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant { 42bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant T1 t1(Duration1(3)); 43bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant T1 t2(Duration1(3)); 44bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert(!(t1 < t2)); 45bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert(!(t1 > t2)); 46bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert( (t1 <= t2)); 47bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert( (t1 >= t2)); 48bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant } 49bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant { 50bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant T1 t1(Duration1(3)); 51bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant T1 t2(Duration1(4)); 52bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert( (t1 < t2)); 53bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert(!(t1 > t2)); 54bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert( (t1 <= t2)); 55bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert(!(t1 >= t2)); 56bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant } 57bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant { 58bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant T1 t1(Duration1(3)); 59bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant T2 t2(Duration2(3000)); 60bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert(!(t1 < t2)); 61bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert(!(t1 > t2)); 62bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert( (t1 <= t2)); 63bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert( (t1 >= t2)); 64bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant } 65bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant { 66bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant T1 t1(Duration1(3)); 67bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant T2 t2(Duration2(3001)); 68bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert( (t1 < t2)); 69bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert(!(t1 > t2)); 70bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert( (t1 <= t2)); 71bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant assert(!(t1 >= t2)); 72bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant } 73832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow 74832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow#if _LIBCPP_STD_VER > 11 75832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow { 76832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow constexpr T1 t1(Duration1(3)); 77832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow constexpr T1 t2(Duration1(3)); 78832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert(!(t1 < t2), ""); 79832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert(!(t1 > t2), ""); 80832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert( (t1 <= t2), ""); 81832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert( (t1 >= t2), ""); 82832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow } 83832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow { 84832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow constexpr T1 t1(Duration1(3)); 85832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow constexpr T1 t2(Duration1(4)); 86832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert( (t1 < t2), ""); 87832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert(!(t1 > t2), ""); 88832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert( (t1 <= t2), ""); 89832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert(!(t1 >= t2), ""); 90832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow } 91832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow { 92832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow constexpr T1 t1(Duration1(3)); 93832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow constexpr T2 t2(Duration2(3000)); 94832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert(!(t1 < t2), ""); 95832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert(!(t1 > t2), ""); 96832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert( (t1 <= t2), ""); 97832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert( (t1 >= t2), ""); 98832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow } 99832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow { 100832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow constexpr T1 t1(Duration1(3)); 101832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow constexpr T2 t2(Duration2(3001)); 102832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert( (t1 < t2), ""); 103832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert(!(t1 > t2), ""); 104832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert( (t1 <= t2), ""); 105832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow static_assert(!(t1 >= t2), ""); 106832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow } 107832b304076afcd832a5ffe95281b46a7abdaf869Marshall Clow#endif 108bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant} 109