1 // 2 // detail/chrono.hpp 3 // ~~~~~~~~~~~~~~~~~ 4 // 5 // Copyright (c) 2003-2021 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 // 7 // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 // 10 11 #ifndef BOOST_ASIO_DETAIL_CHRONO_HPP 12 #define BOOST_ASIO_DETAIL_CHRONO_HPP 13 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 # pragma once 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 18 #include <boost/asio/detail/config.hpp> 19 20 #if defined(BOOST_ASIO_HAS_STD_CHRONO) 21 # include <chrono> 22 #elif defined(BOOST_ASIO_HAS_BOOST_CHRONO) 23 # include <boost/chrono/system_clocks.hpp> 24 #endif // defined(BOOST_ASIO_HAS_BOOST_CHRONO) 25 26 namespace boost { 27 namespace asio { 28 namespace chrono { 29 30 #if defined(BOOST_ASIO_HAS_STD_CHRONO) 31 using std::chrono::duration; 32 using std::chrono::time_point; 33 using std::chrono::duration_cast; 34 using std::chrono::nanoseconds; 35 using std::chrono::microseconds; 36 using std::chrono::milliseconds; 37 using std::chrono::seconds; 38 using std::chrono::minutes; 39 using std::chrono::hours; 40 using std::chrono::time_point_cast; 41 #if defined(BOOST_ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK) 42 typedef std::chrono::monotonic_clock steady_clock; 43 #else // defined(BOOST_ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK) 44 using std::chrono::steady_clock; 45 #endif // defined(BOOST_ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK) 46 using std::chrono::system_clock; 47 using std::chrono::high_resolution_clock; 48 #elif defined(BOOST_ASIO_HAS_BOOST_CHRONO) 49 using boost::chrono::duration; 50 using boost::chrono::time_point; 51 using boost::chrono::duration_cast; 52 using boost::chrono::nanoseconds; 53 using boost::chrono::microseconds; 54 using boost::chrono::milliseconds; 55 using boost::chrono::seconds; 56 using boost::chrono::minutes; 57 using boost::chrono::hours; 58 using boost::chrono::time_point_cast; 59 using boost::chrono::system_clock; 60 using boost::chrono::steady_clock; 61 using boost::chrono::high_resolution_clock; 62 #endif // defined(BOOST_ASIO_HAS_BOOST_CHRONO) 63 64 } // namespace chrono 65 } // namespace asio 66 } // namespace boost 67 68 #endif // BOOST_ASIO_DETAIL_CHRONO_HPP 69