Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:49

0001 //  boost/chrono/thread_clock.hpp  -----------------------------------------------------------//
0002 
0003 //  Copyright 2009-2011 Vicente J. Botet Escriba
0004 
0005 //  Distributed under the Boost Software License, Version 1.0.
0006 //  See http://www.boost.org/LICENSE_1_0.txt
0007 
0008 //  See http://www.boost.org/libs/system for documentation.
0009 
0010 #include <boost/chrono/config.hpp>
0011 
0012 #ifndef BOOST_CHRONO_THREAD_CLOCK_HPP
0013 #define BOOST_CHRONO_THREAD_CLOCK_HPP
0014 
0015 #if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
0016 
0017 #include <boost/chrono/config.hpp>
0018 #include <boost/chrono/duration.hpp>
0019 #include <boost/chrono/time_point.hpp>
0020 #include <boost/chrono/detail/system.hpp>
0021 #include <boost/chrono/clock_string.hpp>
0022 
0023 #ifndef BOOST_CHRONO_HEADER_ONLY
0024 #include <boost/config/abi_prefix.hpp> // must be the last #include
0025 #endif
0026 
0027 namespace boost { namespace chrono {
0028 
0029 class BOOST_CHRONO_DECL thread_clock {
0030 public:
0031     typedef nanoseconds                          duration;
0032     typedef duration::rep                        rep;
0033     typedef duration::period                     period;
0034     typedef chrono::time_point<thread_clock>    time_point;
0035     BOOST_STATIC_CONSTEXPR bool is_steady =             BOOST_CHRONO_THREAD_CLOCK_IS_STEADY;
0036 
0037     static BOOST_CHRONO_INLINE time_point now( ) BOOST_NOEXCEPT;
0038 #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
0039     static BOOST_CHRONO_INLINE time_point now( system::error_code & ec );
0040 #endif
0041 };
0042 
0043 template <class CharT>
0044 struct clock_string<thread_clock, CharT>
0045 {
0046   static std::basic_string<CharT> name()
0047   {
0048     static const CharT u[] =
0049     { 't', 'h', 'r', 'e', 'a', 'd', '_',
0050       'c', 'l','o', 'c', 'k'};
0051     static const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
0052     return str;
0053   }
0054   static std::basic_string<CharT> since()
0055   {
0056     const CharT u[] =
0057     { ' ', 's', 'i', 'n', 'c', 'e', ' ', 't', 'h', 'r', 'e', 'a', 'd', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p'};
0058     const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
0059     return str;
0060   }
0061 };
0062 
0063 } // namespace chrono
0064 } // namespace boost
0065 
0066 
0067 #ifndef BOOST_CHRONO_HEADER_ONLY
0068 #include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas
0069 #else
0070 #include <boost/chrono/detail/inlined/thread_clock.hpp>
0071 #endif
0072 
0073 #endif
0074 
0075 #endif  // BOOST_CHRONO_THREAD_CLOCK_HPP