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 // time_points with different clocks should not compare
     23 
     24 #include <chrono>
     25 
     26 #include "../../clock.h"
     27 
     28 int main()
     29 {
     30     typedef std::chrono::system_clock Clock1;
     31     typedef Clock                     Clock2;
     32     typedef std::chrono::milliseconds Duration1;
     33     typedef std::chrono::microseconds Duration2;
     34     typedef std::chrono::time_point<Clock1, Duration1> T1;
     35     typedef std::chrono::time_point<Clock2, Duration2> T2;
     36 
     37     T1 t1(Duration1(3));
     38     T2 t2(Duration2(3000));
     39     t1 == t2;
     40 }
     41