File indexing completed on 2025-01-30 09:33:47
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_ASIO_WAIT_TRAITS_HPP
0012 #define BOOST_ASIO_WAIT_TRAITS_HPP
0013
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif
0017
0018 #include <boost/asio/detail/push_options.hpp>
0019
0020 namespace boost {
0021 namespace asio {
0022
0023
0024 template <typename Clock>
0025 struct wait_traits
0026 {
0027
0028
0029
0030
0031 static typename Clock::duration to_wait_duration(
0032 const typename Clock::duration& d)
0033 {
0034 return d;
0035 }
0036
0037
0038
0039
0040
0041 static typename Clock::duration to_wait_duration(
0042 const typename Clock::time_point& t)
0043 {
0044 typename Clock::time_point now = Clock::now();
0045 if (now + (Clock::duration::max)() < t)
0046 return (Clock::duration::max)();
0047 if (now + (Clock::duration::min)() > t)
0048 return (Clock::duration::min)();
0049 return t - now;
0050 }
0051 };
0052
0053 }
0054 }
0055
0056 #include <boost/asio/detail/pop_options.hpp>
0057
0058 #endif