13 #ifndef _ASIO_SERVICE_DISCOVERY_STD_CHRONO_TIME_TRAITS_HPP_
14 #define _ASIO_SERVICE_DISCOVERY_STD_CHRONO_TIME_TRAITS_HPP_
21 namespace networking {
35 template<
typename Clock>
38 typedef typename Clock::time_point time_type;
39 typedef typename Clock::duration duration_type;
41 static time_type now()
46 static time_type add(time_type t, duration_type d)
51 static duration_type subtract(time_type t1, time_type t2)
56 static bool less_than(time_type t1, time_type t2)
61 static boost::posix_time::time_duration
62 to_posix_duration(duration_type d1)
64 using std::chrono::duration_cast;
65 auto in_sec = duration_cast<std::chrono::seconds>(d1);
66 auto in_usec = duration_cast<std::chrono::microseconds>(d1 - in_sec);
67 boost::posix_time::time_duration result =
68 boost::posix_time::seconds(in_sec.count()) +
69 boost::posix_time::microseconds(in_usec.count());
78 #endif //_ASIO_SERVICE_DISCOVERY_STD_CHRONO_TIME_TRAITS_HPP_
Definition: std_chrono_time_traits.hpp:36