1 // boost/chrono/thread_clock.hpp -----------------------------------------------------------//
3 // Copyright 2009-2011 Vicente J. Botet Escriba
5 // Distributed under the Boost Software License, Version 1.0.
6 // See http://www.boost.org/LICENSE_1_0.txt
8 // See http://www.boost.org/libs/system for documentation.
10 #include <boost/chrono/config.hpp>
12 #ifndef BOOST_CHRONO_THREAD_CLOCK_HPP
13 #define BOOST_CHRONO_THREAD_CLOCK_HPP
15 #if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
17 #include <boost/chrono/config.hpp>
18 #include <boost/chrono/duration.hpp>
19 #include <boost/chrono/time_point.hpp>
20 #include <boost/chrono/detail/system.hpp>
21 #include <boost/chrono/clock_string.hpp>
23 #ifndef BOOST_CHRONO_HEADER_ONLY
24 #include <boost/config/abi_prefix.hpp> // must be the last #include
27 namespace boost { namespace chrono {
29 class BOOST_CHRONO_DECL thread_clock {
31 typedef nanoseconds duration;
32 typedef duration::rep rep;
33 typedef duration::period period;
34 typedef chrono::time_point<thread_clock> time_point;
35 BOOST_STATIC_CONSTEXPR bool is_steady = BOOST_CHRONO_THREAD_CLOCK_IS_STEADY;
37 static BOOST_CHRONO_INLINE time_point now( ) BOOST_NOEXCEPT;
38 #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
39 static BOOST_CHRONO_INLINE time_point now( system::error_code & ec );
43 template <class CharT>
44 struct clock_string<thread_clock, CharT>
46 static std::basic_string<CharT> name()
48 static const CharT u[] =
49 { 't', 'h', 'r', 'e', 'a', 'd', '_',
50 'c', 'l','o', 'c', 'k'};
51 static const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
54 static std::basic_string<CharT> since()
57 { ' ', 's', 'i', 'n', 'c', 'e', ' ', 't', 'h', 'r', 'e', 'a', 'd', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p'};
58 const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
67 #ifndef BOOST_CHRONO_HEADER_ONLY
68 #include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas
70 #include <boost/chrono/detail/inlined/thread_clock.hpp>
75 #endif // BOOST_CHRONO_THREAD_CLOCK_HPP