1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- #ifndef BOOST_ASIO_TIME_TRAITS_HPP
- #define BOOST_ASIO_TIME_TRAITS_HPP
- #if defined(_MSC_VER) && (_MSC_VER >= 1200)
- # pragma once
- #endif
- #include <boost/asio/detail/push_options.hpp>
- #include <boost/asio/detail/socket_types.hpp>
- #include <boost/asio/detail/push_options.hpp>
- #include <boost/date_time/posix_time/posix_time_types.hpp>
- #include <boost/asio/detail/pop_options.hpp>
- namespace boost {
- namespace asio {
- template <typename Time>
- struct time_traits;
- template <>
- struct time_traits<boost::posix_time::ptime>
- {
-
- typedef boost::posix_time::ptime time_type;
-
- typedef boost::posix_time::time_duration duration_type;
-
- static time_type now()
- {
- return boost::posix_time::microsec_clock::universal_time();
- }
-
- static time_type add(const time_type& t, const duration_type& d)
- {
- return t + d;
- }
-
- static duration_type subtract(const time_type& t1, const time_type& t2)
- {
- return t1 - t2;
- }
-
- static bool less_than(const time_type& t1, const time_type& t2)
- {
- return t1 < t2;
- }
-
- static boost::posix_time::time_duration to_posix_duration(
- const duration_type& d)
- {
- return d;
- }
- };
- }
- }
- #include <boost/asio/detail/pop_options.hpp>
- #endif
|