1 | // |
2 | // steady_timer.hpp |
3 | // ~~~~~~~~~~~~~~~~ |
4 | // |
5 | // Copyright (c) 2003-2015 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_STEADY_TIMER_HPP |
12 | #define BOOST_ASIO_STEADY_TIMER_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 | || defined(BOOST_ASIO_HAS_BOOST_CHRONO) \ |
22 | || defined(GENERATING_DOCUMENTATION) |
23 | |
24 | #if defined(BOOST_ASIO_HAS_STD_CHRONO) |
25 | # include <chrono> |
26 | #elif defined(BOOST_ASIO_HAS_BOOST_CHRONO) |
27 | # include <boost/chrono/system_clocks.hpp> |
28 | #endif |
29 | |
30 | #include <boost/asio/basic_waitable_timer.hpp> |
31 | |
32 | namespace boost { |
33 | namespace asio { |
34 | |
35 | #if defined(GENERATING_DOCUMENTATION) |
36 | /// Typedef for a timer based on the steady clock. |
37 | /** |
38 | * This typedef uses the C++11 @c <chrono> standard library facility, if |
39 | * available. Otherwise, it may use the Boost.Chrono library. To explicitly |
40 | * utilise Boost.Chrono, use the basic_waitable_timer template directly: |
41 | * @code |
42 | * typedef basic_waitable_timer<boost::chrono::steady_clock> timer; |
43 | * @endcode |
44 | */ |
45 | typedef basic_waitable_timer<chrono::steady_clock> steady_timer; |
46 | #elif defined(BOOST_ASIO_HAS_STD_CHRONO) |
47 | # if defined(BOOST_ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK) |
48 | typedef basic_waitable_timer<std::chrono::monotonic_clock> steady_timer; |
49 | # else // defined(BOOST_ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK) |
50 | typedef basic_waitable_timer<std::chrono::steady_clock> steady_timer; |
51 | # endif // defined(BOOST_ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK) |
52 | #elif defined(BOOST_ASIO_HAS_BOOST_CHRONO) |
53 | typedef basic_waitable_timer<boost::chrono::steady_clock> steady_timer; |
54 | #endif |
55 | |
56 | } // namespace asio |
57 | } // namespace boost |
58 | |
59 | #endif // defined(BOOST_ASIO_HAS_STD_CHRONO) |
60 | // || defined(BOOST_ASIO_HAS_BOOST_CHRONO) |
61 | // || defined(GENERATING_DOCUMENTATION) |
62 | |
63 | #endif // BOOST_ASIO_STEADY_TIMER_HPP |
64 | |