Warning, file /include/boost/chrono/system_clocks.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058 #ifndef BOOST_CHRONO_SYSTEM_CLOCKS_HPP
0059 #define BOOST_CHRONO_SYSTEM_CLOCKS_HPP
0060
0061 #include <boost/chrono/config.hpp>
0062 #include <boost/chrono/duration.hpp>
0063 #include <boost/chrono/time_point.hpp>
0064 #include <boost/chrono/detail/system.hpp>
0065 #include <boost/chrono/clock_string.hpp>
0066 #include <boost/ratio/config.hpp>
0067
0068 #include <ctime>
0069
0070 # if defined( BOOST_CHRONO_POSIX_API )
0071 # if ! defined(CLOCK_REALTIME) && ! defined (__hpux__)
0072 # error <time.h> does not supply CLOCK_REALTIME
0073 # endif
0074 # endif
0075
0076 #ifdef BOOST_CHRONO_WINDOWS_API
0077
0078 # define BOOST_SYSTEM_CLOCK_DURATION boost::chrono::duration<boost::int_least64_t, ratio<BOOST_RATIO_INTMAX_C(1), BOOST_RATIO_INTMAX_C(10000000)> >
0079 #else
0080 # define BOOST_SYSTEM_CLOCK_DURATION boost::chrono::nanoseconds
0081 #endif
0082
0083
0084 #ifndef BOOST_CHRONO_HEADER_ONLY
0085 #include <boost/config/abi_prefix.hpp> // must be the last #include
0086 #endif
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096 namespace boost {
0097 namespace chrono {
0098
0099
0100 class system_clock;
0101 #ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
0102 class steady_clock;
0103 #endif
0104
0105 #ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
0106 typedef steady_clock high_resolution_clock;
0107 #else
0108 typedef system_clock high_resolution_clock;
0109 #endif
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128 class BOOST_CHRONO_DECL system_clock
0129 {
0130 public:
0131 typedef BOOST_SYSTEM_CLOCK_DURATION duration;
0132 typedef duration::rep rep;
0133 typedef duration::period period;
0134 typedef chrono::time_point<system_clock> time_point;
0135 BOOST_STATIC_CONSTEXPR bool is_steady = false;
0136
0137 static BOOST_CHRONO_INLINE time_point now() BOOST_NOEXCEPT;
0138 #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
0139 static BOOST_CHRONO_INLINE time_point now(system::error_code & ec);
0140 #endif
0141
0142 static BOOST_CHRONO_INLINE std::time_t to_time_t(const time_point& t) BOOST_NOEXCEPT;
0143 static BOOST_CHRONO_INLINE time_point from_time_t(std::time_t t) BOOST_NOEXCEPT;
0144 };
0145
0146
0147
0148
0149
0150
0151
0152
0153 #ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
0154 class BOOST_CHRONO_DECL steady_clock
0155 {
0156 public:
0157 typedef nanoseconds duration;
0158 typedef duration::rep rep;
0159 typedef duration::period period;
0160 typedef chrono::time_point<steady_clock> time_point;
0161 BOOST_STATIC_CONSTEXPR bool is_steady = true;
0162
0163 static BOOST_CHRONO_INLINE time_point now() BOOST_NOEXCEPT;
0164 #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
0165 static BOOST_CHRONO_INLINE time_point now(system::error_code & ec);
0166 #endif
0167 };
0168 #endif
0169
0170
0171
0172
0173
0174
0175
0176
0177 template<class CharT>
0178 struct clock_string<system_clock, CharT>
0179 {
0180 static std::basic_string<CharT> name()
0181 {
0182 static const CharT u[] =
0183 { 's', 'y', 's', 't', 'e', 'm', '_', 'c', 'l', 'o', 'c', 'k' };
0184 static const std::basic_string<CharT> str(u, u + sizeof(u)
0185 / sizeof(u[0]));
0186 return str;
0187 }
0188 static std::basic_string<CharT> since()
0189 {
0190 static const CharT
0191 u[] =
0192 { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'J', 'a', 'n', ' ', '1', ',', ' ', '1', '9', '7', '0' };
0193 static const std::basic_string<CharT> str(u, u + sizeof(u)
0194 / sizeof(u[0]));
0195 return str;
0196 }
0197 };
0198
0199 #ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
0200
0201 template<class CharT>
0202 struct clock_string<steady_clock, CharT>
0203 {
0204 static std::basic_string<CharT> name()
0205 {
0206 static const CharT
0207 u[] =
0208 { 's', 't', 'e', 'a', 'd', 'y', '_', 'c', 'l', 'o', 'c', 'k' };
0209 static const std::basic_string<CharT> str(u, u + sizeof(u)
0210 / sizeof(u[0]));
0211 return str;
0212 }
0213 static std::basic_string<CharT> since()
0214 {
0215 const CharT u[] =
0216 { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'b', 'o', 'o', 't' };
0217 const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
0218 return str;
0219 }
0220 };
0221
0222 #endif
0223
0224 }
0225 }
0226
0227 #ifndef BOOST_CHRONO_HEADER_ONLY
0228
0229 #include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas
0230 #else
0231 #include <boost/chrono/detail/inlined/chrono.hpp>
0232 #endif
0233
0234 #endif