chrono.hpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. #ifndef BOOST_ASIO_DETAIL_CHRONO_HPP
  11. #define BOOST_ASIO_DETAIL_CHRONO_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include <boost/asio/detail/config.hpp>
  16. #if defined(BOOST_ASIO_HAS_STD_CHRONO)
  17. # include <chrono>
  18. #elif defined(BOOST_ASIO_HAS_BOOST_CHRONO)
  19. # include <boost/chrono/system_clocks.hpp>
  20. #endif // defined(BOOST_ASIO_HAS_BOOST_CHRONO)
  21. namespace boost {
  22. namespace asio {
  23. namespace chrono {
  24. #if defined(BOOST_ASIO_HAS_STD_CHRONO)
  25. using std::chrono::duration;
  26. using std::chrono::time_point;
  27. using std::chrono::duration_cast;
  28. using std::chrono::nanoseconds;
  29. using std::chrono::microseconds;
  30. using std::chrono::milliseconds;
  31. using std::chrono::seconds;
  32. using std::chrono::minutes;
  33. using std::chrono::hours;
  34. using std::chrono::time_point_cast;
  35. #if defined(BOOST_ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK)
  36. typedef std::chrono::monotonic_clock steady_clock;
  37. #else // defined(BOOST_ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK)
  38. using std::chrono::steady_clock;
  39. #endif // defined(BOOST_ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK)
  40. using std::chrono::system_clock;
  41. using std::chrono::high_resolution_clock;
  42. #elif defined(BOOST_ASIO_HAS_BOOST_CHRONO)
  43. using boost::chrono::duration;
  44. using boost::chrono::time_point;
  45. using boost::chrono::duration_cast;
  46. using boost::chrono::nanoseconds;
  47. using boost::chrono::microseconds;
  48. using boost::chrono::milliseconds;
  49. using boost::chrono::seconds;
  50. using boost::chrono::minutes;
  51. using boost::chrono::hours;
  52. using boost::chrono::time_point_cast;
  53. using boost::chrono::system_clock;
  54. using boost::chrono::steady_clock;
  55. using boost::chrono::high_resolution_clock;
  56. #endif // defined(BOOST_ASIO_HAS_BOOST_CHRONO)
  57. } // namespace chrono
  58. } // namespace asio
  59. } // namespace boost
  60. #endif // BOOST_ASIO_DETAIL_CHRONO_HPP