Home | History | Annotate | Download | only in time.point.comparisons
      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 // time_point
     13 
     14 // template <class Clock, class Duration1, class Duration2>
     15 //   bool
     16 //   operator< (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
     17 
     18 // template <class Clock, class Duration1, class Duration2>
     19 //   bool
     20 //   operator> (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
     21 
     22 // template <class Clock, class Duration1, class Duration2>
     23 //   bool
     24 //   operator<=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
     25 
     26 // template <class Clock, class Duration1, class Duration2>
     27 //   bool
     28 //   operator>=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
     29 
     30 // time_points with different clocks should not compare
     31 
     32 #include <chrono>
     33 
     34 #include "../../clock.h"
     35 
     36 int main()
     37 {
     38     typedef std::chrono::system_clock Clock1;
     39     typedef Clock                     Clock2;
     40     typedef std::chrono::milliseconds Duration1;
     41     typedef std::chrono::microseconds Duration2;
     42     typedef std::chrono::time_point<Clock1, Duration1> T1;
     43     typedef std::chrono::time_point<Clock2, Duration2> T2;
     44 
     45     T1 t1(Duration1(3));
     46     T2 t2(Duration2(3000));
     47     t1 < t2;
     48 }
     49