11 #ifndef ASIO_TIME_TRAITS_HPP 12 #define ASIO_TIME_TRAITS_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 20 #if defined(ASIO_HAS_BOOST_DATE_TIME) \ 21 || defined(GENERATING_DOCUMENTATION) 23 #include <boost/date_time/posix_time/posix_time_types.hpp> 30 template <
typename Time>
35 struct time_traits<
boost::posix_time::ptime>
38 typedef boost::posix_time::ptime time_type;
41 typedef boost::posix_time::time_duration duration_type;
44 static time_type now()
46 #if defined(BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK) 47 return boost::posix_time::microsec_clock::universal_time();
48 #else // defined(BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK) 49 return boost::posix_time::second_clock::universal_time();
50 #endif // defined(BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK) 54 static time_type add(
const time_type& t,
const duration_type& d)
60 static duration_type subtract(
const time_type& t1,
const time_type& t2)
66 static bool less_than(
const time_type& t1,
const time_type& t2)
72 static boost::posix_time::time_duration to_posix_duration(
73 const duration_type& d)
83 #endif // defined(ASIO_HAS_BOOST_DATE_TIME) 86 #endif // ASIO_TIME_TRAITS_HPP