diff options
Diffstat (limited to 'boost/chrono')
-rw-r--r-- | boost/chrono/config.hpp | 23 | ||||
-rw-r--r-- | boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp | 67 | ||||
-rw-r--r-- | boost/chrono/detail/inlined/posix/thread_clock.hpp | 11 | ||||
-rw-r--r-- | boost/chrono/detail/inlined/win/chrono.hpp | 1 | ||||
-rw-r--r-- | boost/chrono/detail/inlined/win/process_cpu_clocks.hpp | 6 | ||||
-rw-r--r-- | boost/chrono/detail/no_warning/signed_unsigned_cmp.hpp | 2 | ||||
-rw-r--r-- | boost/chrono/detail/scan_keyword.hpp | 7 | ||||
-rw-r--r-- | boost/chrono/detail/system.hpp | 5 | ||||
-rw-r--r-- | boost/chrono/duration.hpp | 19 | ||||
-rw-r--r-- | boost/chrono/process_cpu_clocks.hpp | 4 | ||||
-rw-r--r-- | boost/chrono/system_clocks.hpp | 12 | ||||
-rw-r--r-- | boost/chrono/thread_clock.hpp | 7 | ||||
-rw-r--r-- | boost/chrono/time_point.hpp | 20 |
13 files changed, 107 insertions, 77 deletions
diff --git a/boost/chrono/config.hpp b/boost/chrono/config.hpp index a852b103a7..b7d0c0d198 100644 --- a/boost/chrono/config.hpp +++ b/boost/chrono/config.hpp @@ -13,6 +13,14 @@ #include <boost/config.hpp> +#if !defined BOOST_CHRONO_VERSION +#define BOOST_CHRONO_VERSION 1 +#else +#if BOOST_CHRONO_VERSION!=1 && BOOST_CHRONO_VERSION!=2 +#error "BOOST_CHRONO_VERSION must be 1 or 2" +#endif +#endif + #if defined(BOOST_CHRONO_SOURCE) && !defined(BOOST_USE_WINDOWS_H) #define BOOST_USE_WINDOWS_H #endif @@ -62,12 +70,8 @@ # if defined( BOOST_CHRONO_POSIX_API ) # define BOOST_CHRONO_HAS_PROCESS_CLOCKS # include <time.h> //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME -# if defined(CLOCK_REALTIME) -# if defined(CLOCK_MONOTONIC) -# define BOOST_CHRONO_HAS_CLOCK_STEADY -# endif -# else -# error <time.h> does not supply CLOCK_REALTIME +# if defined(CLOCK_MONOTONIC) +# define BOOST_CHRONO_HAS_CLOCK_STEADY # endif # if defined(_POSIX_THREAD_CPUTIME) && !defined(BOOST_DISABLE_THREADS) # define BOOST_CHRONO_HAS_THREAD_CLOCK @@ -81,6 +85,10 @@ # undef BOOST_CHRONO_HAS_THREAD_CLOCK # undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY # endif +# if defined(__HP_aCC) && defined(__hpux) +# undef BOOST_CHRONO_HAS_THREAD_CLOCK +# undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY +# endif # endif #if defined(BOOST_CHRONO_THREAD_DISABLED) && defined(BOOST_CHRONO_HAS_THREAD_CLOCK) @@ -88,6 +96,7 @@ #undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY #endif +//#undef BOOST_CHRONO_HAS_PROCESS_CLOCKS // unicode support ------------------------------// @@ -134,7 +143,6 @@ #define BOOST_CHRONO_DECL #endif - //#define BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING // enable automatic library variant selection ------------------------------// @@ -158,4 +166,3 @@ #endif // auto-linking disabled #endif // BOOST_CHRONO_HEADER_ONLY #endif // BOOST_CHRONO_CONFIG_HPP - diff --git a/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp b/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp index d76d9356cf..5d5c4f4806 100644 --- a/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp +++ b/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp @@ -32,8 +32,8 @@ namespace chrono_detail factor = -1; else { - BOOST_ASSERT( factor <= 1000000l ); // doesn't handle large ticks - factor = 1000000l / factor; // compute factor + BOOST_ASSERT( factor <= 1000000000l ); // doesn't handle large ticks + factor = 1000000000l / factor; // compute factor if ( !factor ) factor = -1; } } @@ -54,7 +54,7 @@ process_real_cpu_clock::time_point process_real_cpu_clock::now() BOOST_NOEXCEPT if ( chrono_detail::tick_factor() != -1 ) { return time_point( - microseconds(c*chrono_detail::tick_factor())); + nanoseconds(c*chrono_detail::tick_factor())); } else { @@ -66,9 +66,9 @@ process_real_cpu_clock::time_point process_real_cpu_clock::now() BOOST_NOEXCEPT #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING process_real_cpu_clock::time_point process_real_cpu_clock::now( - system::error_code & ec) + system::error_code & ec) { - + tms tm; clock_t c = ::times( &tm ); if ( c == clock_t(-1) ) // error @@ -76,9 +76,9 @@ process_real_cpu_clock::time_point process_real_cpu_clock::now( if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - errno, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_real_cpu_clock" )); } else @@ -91,21 +91,21 @@ process_real_cpu_clock::time_point process_real_cpu_clock::now( { if ( chrono_detail::tick_factor() != -1 ) { - if (!BOOST_CHRONO_IS_THROWS(ec)) + if (!BOOST_CHRONO_IS_THROWS(ec)) { ec.clear(); } return time_point( - microseconds(c*chrono_detail::tick_factor())); + nanoseconds(c*chrono_detail::tick_factor())); } else { if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - errno, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_real_cpu_clock" )); } else @@ -131,7 +131,7 @@ process_user_cpu_clock::time_point process_user_cpu_clock::now() BOOST_NOEXCEPT if ( chrono_detail::tick_factor() != -1 ) { return time_point( - microseconds((tm.tms_utime + tm.tms_cutime)*chrono_detail::tick_factor())); + nanoseconds((tm.tms_utime + tm.tms_cutime)*chrono_detail::tick_factor())); } else { @@ -152,9 +152,9 @@ process_user_cpu_clock::time_point process_user_cpu_clock::now( if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - errno, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_user_cpu_clock" )); } else @@ -167,21 +167,21 @@ process_user_cpu_clock::time_point process_user_cpu_clock::now( { if ( chrono_detail::tick_factor() != -1 ) { - if (!BOOST_CHRONO_IS_THROWS(ec)) + if (!BOOST_CHRONO_IS_THROWS(ec)) { ec.clear(); } return time_point( - microseconds((tm.tms_utime + tm.tms_cutime)*chrono_detail::tick_factor())); + nanoseconds((tm.tms_utime + tm.tms_cutime)*chrono_detail::tick_factor())); } else { if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - errno, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_user_cpu_clock" )); } else @@ -208,11 +208,12 @@ process_system_cpu_clock::time_point process_system_cpu_clock::now() BOOST_NOEXC if ( chrono_detail::tick_factor() != -1 ) { return time_point( - microseconds((tm.tms_stime + tm.tms_cstime)*chrono_detail::tick_factor())); + nanoseconds((tm.tms_stime + tm.tms_cstime)*chrono_detail::tick_factor())); } else { BOOST_ASSERT(0 && "Boost::Chrono - Internal Error"); + return time_point(); } } } @@ -248,7 +249,7 @@ process_system_cpu_clock::time_point process_system_cpu_clock::now( ec.clear(); } return time_point( - microseconds((tm.tms_stime + tm.tms_cstime)*chrono_detail::tick_factor())); + nanoseconds((tm.tms_stime + tm.tms_cstime)*chrono_detail::tick_factor())); } else { @@ -297,8 +298,8 @@ process_cpu_clock::time_point process_cpu_clock::now() BOOST_NOEXCEPT } #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING -process_cpu_clock::time_point process_cpu_clock::now( - system::error_code & ec ) +process_cpu_clock::time_point process_cpu_clock::now( + system::error_code & ec ) { tms tm; clock_t c = ::times( &tm ); @@ -307,9 +308,9 @@ process_cpu_clock::time_point process_cpu_clock::now( if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - errno, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_clock" )); } else @@ -333,9 +334,9 @@ process_cpu_clock::time_point process_cpu_clock::now( if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - errno, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_clock" )); } else @@ -345,7 +346,7 @@ process_cpu_clock::time_point process_cpu_clock::now( } } } - + } #endif diff --git a/boost/chrono/detail/inlined/posix/thread_clock.hpp b/boost/chrono/detail/inlined/posix/thread_clock.hpp index 5ad41f84e3..42a544a0d6 100644 --- a/boost/chrono/detail/inlined/posix/thread_clock.hpp +++ b/boost/chrono/detail/inlined/posix/thread_clock.hpp @@ -15,6 +15,7 @@ #include <cassert> # include <sys/times.h> +# include <pthread.h> # include <unistd.h> namespace boost { namespace chrono { @@ -45,7 +46,7 @@ namespace boost { namespace chrono { } #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING - thread_clock::time_point thread_clock::now( system::error_code & ec ) + thread_clock::time_point thread_clock::now( system::error_code & ec ) { struct timespec ts; #if defined CLOCK_THREAD_CPUTIME_ID @@ -64,9 +65,9 @@ namespace boost { namespace chrono { if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - errno, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::thread_clock" )); } else @@ -75,7 +76,7 @@ namespace boost { namespace chrono { return time_point(); } } - if (!BOOST_CHRONO_IS_THROWS(ec)) + if (!BOOST_CHRONO_IS_THROWS(ec)) { ec.clear(); } diff --git a/boost/chrono/detail/inlined/win/chrono.hpp b/boost/chrono/detail/inlined/win/chrono.hpp index d953fe4bb4..75160dba97 100644 --- a/boost/chrono/detail/inlined/win/chrono.hpp +++ b/boost/chrono/detail/inlined/win/chrono.hpp @@ -42,6 +42,7 @@ namespace chrono_detail (!boost::detail::win32::QueryPerformanceCounter( &pcount )) ) { BOOST_ASSERT(0 && "Boost::Chrono - Internal Error"); + return steady_clock::time_point(); } return steady_clock::time_point(steady_clock::duration( diff --git a/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp b/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp index 6453aa600a..1b7e67a120 100644 --- a/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp +++ b/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp @@ -34,8 +34,9 @@ process_real_cpu_clock::time_point process_real_cpu_clock::now() BOOST_NOEXCEPT { BOOST_ASSERT(0 && "Boost::Chrono - Internal Error"); } + typedef ratio_divide<giga, ratio<CLOCKS_PER_SEC> >::type R; return time_point( - duration(c*(1000000000l/CLOCKS_PER_SEC)) + duration(static_cast<rep>(c)*R::num/R::den) ); } @@ -56,8 +57,9 @@ process_real_cpu_clock::time_point process_real_cpu_clock::now( { ec.clear(); } + typedef ratio_divide<giga, ratio<CLOCKS_PER_SEC> >::type R; return time_point( - duration(c*(1000000000l/CLOCKS_PER_SEC)) + duration(static_cast<rep>(c)*R::num/R::den) ); } #endif diff --git a/boost/chrono/detail/no_warning/signed_unsigned_cmp.hpp b/boost/chrono/detail/no_warning/signed_unsigned_cmp.hpp index 78a0ce13e7..491c1d64a0 100644 --- a/boost/chrono/detail/no_warning/signed_unsigned_cmp.hpp +++ b/boost/chrono/detail/no_warning/signed_unsigned_cmp.hpp @@ -41,4 +41,4 @@ namespace detail { } // namespace detail } // namespace chrono -#endif // BOOST_CHRONO_DETAIL_IS_EVENLY_DIVISIBLE_BY_HPP +#endif // BOOST_CHRONO_DETAIL_NO_WARNING_SIGNED_UNSIGNED_CMP_HPP diff --git a/boost/chrono/detail/scan_keyword.hpp b/boost/chrono/detail/scan_keyword.hpp index 13ad0ca8c8..7c3ba6e2af 100644 --- a/boost/chrono/detail/scan_keyword.hpp +++ b/boost/chrono/detail/scan_keyword.hpp @@ -23,10 +23,11 @@ #include <ios> #include <exception> #include <stdlib.h> +#include <boost/throw_exception.hpp> namespace boost { using interprocess::unique_ptr; - + namespace chrono { namespace chrono_detail { @@ -65,13 +66,13 @@ scan_keyword(InputIterator& b, InputIterator e, unsigned char statbuf[100]; unsigned char* status = statbuf; // Change free by free_aux to avoid - // Error: Could not find a match for boost::interprocess::unique_ptr<unsigned char, void(*)(void*)>::unique_ptr(int, extern "C" void(void*)) + // Error: Could not find a match for boost::interprocess::unique_ptr<unsigned char, void(*)(void*)>::unique_ptr(int, extern "C" void(void*)) unique_ptr<unsigned char, void(*)(void*)> stat_hold(0, free_aux); if (nkw > sizeof(statbuf)) { status = (unsigned char*)malloc(nkw); if (status == 0) - throw std::bad_alloc(); + throw_exception(std::bad_alloc()); stat_hold.reset(status); } size_t n_might_match = nkw; // At this point, any keyword might match diff --git a/boost/chrono/detail/system.hpp b/boost/chrono/detail/system.hpp index f8a40f12a8..0dcffe8521 100644 --- a/boost/chrono/detail/system.hpp +++ b/boost/chrono/detail/system.hpp @@ -6,6 +6,8 @@ #ifndef BOOST_CHRONO_DETAIL_SYSTEM_HPP #define BOOST_CHRONO_DETAIL_SYSTEM_HPP +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING + #include <boost/version.hpp> #include <boost/system/error_code.hpp> @@ -15,7 +17,7 @@ #define BOOST_CHRONO_SYSTEM_CATEGORY boost::system::system_category() #endif -#ifdef BOOST_SYSTEM_NO_DEPRECATED +#ifdef BOOST_SYSTEM_NO_DEPRECATED #define BOOST_CHRONO_THROWS boost::throws() #define BOOST_CHRONO_IS_THROWS(EC) (&EC==&boost::throws()) #else @@ -24,3 +26,4 @@ #endif #endif +#endif diff --git a/boost/chrono/duration.hpp b/boost/chrono/duration.hpp index 323474014d..e32357cc72 100644 --- a/boost/chrono/duration.hpp +++ b/boost/chrono/duration.hpp @@ -58,6 +58,10 @@ time2_demo contained this comment: #define BOOST_CHRONO_SECOND_TEMPLATE_PARAMETER_OF_TIME_POINT_MUST_BE_A_BOOST_CHRONO_DURATION "Second template parameter of time_point must be a boost::chrono::duration" #endif +#ifndef BOOST_CHRONO_HEADER_ONLY +// this must occur after all of the includes and before any code appears: +#include <boost/config/abi_prefix.hpp> // must be the last #include +#endif //----------------------------------------------------------------------------// // // @@ -447,7 +451,7 @@ namespace chrono { > >::type* = 0 ) : rep_(r) { } - ~duration() {} //= default; + //~duration() {} //= default; BOOST_CONSTEXPR duration(const duration& rhs) : rep_(rhs.rep_) {} // = default; duration& operator=(const duration& rhs) // = default; @@ -660,7 +664,7 @@ namespace detail template <class LhsDuration, class RhsDuration> struct duration_eq { - bool operator()(const LhsDuration& lhs, const RhsDuration& rhs) + BOOST_CONSTEXPR bool operator()(const LhsDuration& lhs, const RhsDuration& rhs) { typedef typename common_type<LhsDuration, RhsDuration>::type CD; return CD(lhs).count() == CD(rhs).count(); @@ -670,7 +674,7 @@ namespace detail template <class LhsDuration> struct duration_eq<LhsDuration, LhsDuration> { - bool operator()(const LhsDuration& lhs, const LhsDuration& rhs) + BOOST_CONSTEXPR bool operator()(const LhsDuration& lhs, const LhsDuration& rhs) { return lhs.count() == rhs.count(); } @@ -679,7 +683,7 @@ namespace detail template <class LhsDuration, class RhsDuration> struct duration_lt { - bool operator()(const LhsDuration& lhs, const RhsDuration& rhs) + BOOST_CONSTEXPR bool operator()(const LhsDuration& lhs, const RhsDuration& rhs) { typedef typename common_type<LhsDuration, RhsDuration>::type CD; return CD(lhs).count() < CD(rhs).count(); @@ -689,7 +693,7 @@ namespace detail template <class LhsDuration> struct duration_lt<LhsDuration, LhsDuration> { - bool operator()(const LhsDuration& lhs, const LhsDuration& rhs) + BOOST_CONSTEXPR bool operator()(const LhsDuration& lhs, const LhsDuration& rhs) { return lhs.count() < rhs.count(); } @@ -783,4 +787,9 @@ namespace detail } // namespace chrono } // namespace boost +#ifndef BOOST_CHRONO_HEADER_ONLY +// the suffix header occurs after all of our code: +#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas +#endif + #endif // BOOST_CHRONO_DURATION_HPP diff --git a/boost/chrono/process_cpu_clocks.hpp b/boost/chrono/process_cpu_clocks.hpp index 12ec2e39bf..486950da40 100644 --- a/boost/chrono/process_cpu_clocks.hpp +++ b/boost/chrono/process_cpu_clocks.hpp @@ -18,15 +18,11 @@ #include <boost/chrono/duration.hpp> #include <boost/chrono/time_point.hpp> #include <boost/operators.hpp> -#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING -#include <boost/system/error_code.hpp> #include <boost/chrono/detail/system.hpp> -#endif #include <iostream> #include <boost/type_traits/common_type.hpp> #include <boost/chrono/clock_string.hpp> - #ifndef BOOST_CHRONO_HEADER_ONLY #include <boost/config/abi_prefix.hpp> // must be the last #include #endif diff --git a/boost/chrono/system_clocks.hpp b/boost/chrono/system_clocks.hpp index bb62610c72..df8b79e207 100644 --- a/boost/chrono/system_clocks.hpp +++ b/boost/chrono/system_clocks.hpp @@ -31,7 +31,6 @@ time2_demo contained this comment: TODO: * Fully implement error handling, with test cases. - * Use boost::throw_exception. (Currently not used because of an issue with Intel 11.0.) * Consider issues raised by Michael Marcin: > In the past I've seen QueryPerformanceCounter give incorrect results, @@ -62,14 +61,17 @@ TODO: #include <boost/chrono/config.hpp> #include <boost/chrono/duration.hpp> #include <boost/chrono/time_point.hpp> -#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING #include <boost/chrono/detail/system.hpp> -#include <boost/system/error_code.hpp> -#endif #include <boost/chrono/clock_string.hpp> #include <ctime> +# if defined( BOOST_CHRONO_POSIX_API ) +# if ! defined(CLOCK_REALTIME) +# error <time.h> does not supply CLOCK_REALTIME +# endif +# endif + #ifdef BOOST_CHRONO_WINDOWS_API // The system_clock tick is 100 nanoseconds # define BOOST_SYSTEM_CLOCK_DURATION boost::chrono::duration<boost::int_least64_t, ratio<BOOST_RATIO_INTMAX_C(1), BOOST_RATIO_INTMAX_C(10000000)> > @@ -77,6 +79,7 @@ TODO: # define BOOST_SYSTEM_CLOCK_DURATION boost::chrono::nanoseconds #endif +// this must occur after all of the includes and before any code appears: #ifndef BOOST_CHRONO_HEADER_ONLY #include <boost/config/abi_prefix.hpp> // must be the last #include #endif @@ -221,6 +224,7 @@ namespace chrono { } // namespace boost #ifndef BOOST_CHRONO_HEADER_ONLY +// the suffix header occurs after all of our code: #include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas #else #include <boost/chrono/detail/inlined/chrono.hpp> diff --git a/boost/chrono/thread_clock.hpp b/boost/chrono/thread_clock.hpp index 7022c61dc1..207697b4cc 100644 --- a/boost/chrono/thread_clock.hpp +++ b/boost/chrono/thread_clock.hpp @@ -17,10 +17,7 @@ #include <boost/chrono/config.hpp> #include <boost/chrono/duration.hpp> #include <boost/chrono/time_point.hpp> -#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING -#include <boost/system/error_code.hpp> #include <boost/chrono/detail/system.hpp> -#endif #include <boost/chrono/clock_string.hpp> #ifndef BOOST_CHRONO_HEADER_ONLY @@ -49,7 +46,7 @@ struct clock_string<thread_clock, CharT> static std::basic_string<CharT> name() { static const CharT u[] = - { 't', 'h', 'r', 'e', 'd', '_', + { 't', 'h', 'r', 'e', 'a', 'd', '_', 'c', 'l','o', 'c', 'k'}; static const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0])); return str; @@ -57,7 +54,7 @@ struct clock_string<thread_clock, CharT> static std::basic_string<CharT> since() { const CharT u[] = - { ' ', 's', 'i', 'n', 'c', 'e', ' ', 't', 'r', 'e', 'a', 'd', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p'}; + { ' ', 's', 'i', 'n', 'c', 'e', ' ', 't', 'h', 'r', 'e', 'a', 'd', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p'}; const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0])); return str; } diff --git a/boost/chrono/time_point.hpp b/boost/chrono/time_point.hpp index bef49cb405..9aad25e66c 100644 --- a/boost/chrono/time_point.hpp +++ b/boost/chrono/time_point.hpp @@ -2,7 +2,7 @@ // Copyright 2008 Howard Hinnant // Copyright 2008 Beman Dawes -// Copyright 2009-2011 Vicente J. Botet Escriba +// Copyright 2009-2012 Vicente J. Botet Escriba // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt @@ -32,8 +32,11 @@ time2_demo contained this comment: #include <boost/chrono/duration.hpp> #include <iostream> -#include <boost/chrono/detail/system.hpp> +#ifndef BOOST_CHRONO_HEADER_ONLY +// this must occur after all of the includes and before any code appears: +#include <boost/config/abi_prefix.hpp> // must be the last #include +#endif //----------------------------------------------------------------------------// // // @@ -160,7 +163,7 @@ namespace chrono { typedef typename duration::rep rep; typedef typename duration::period period; typedef Duration difference_type; - + private: duration d_; @@ -194,7 +197,7 @@ namespace chrono { // arithmetic -#ifdef BOOST_CHRONO_EXTENSIONS +#ifdef BOOST_CHRONO_EXTENSIONS BOOST_CONSTEXPR time_point operator+() const {return *this;} BOOST_CONSTEXPR @@ -202,13 +205,13 @@ namespace chrono { time_point& operator++() {++d_; return *this;} time_point operator++(int) {return time_point(d_++);} time_point& operator--() {--d_; return *this;} - time_point operator--(int) {return time_point(d_--);} + time_point operator--(int) {return time_point(d_--);} time_point& operator+=(const rep& r) {d_ += duration(r); return *this;} time_point& operator-=(const rep& r) {d_ -= duration(r); return *this;} #endif - + time_point& operator+=(const duration& d) {d_ += d; return *this;} time_point& operator-=(const duration& d) {d_ -= d; return *this;} @@ -368,4 +371,9 @@ namespace chrono { } // namespace chrono } // namespace boost +#ifndef BOOST_CHRONO_HEADER_ONLY +// the suffix header occurs after all of our code: +#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas +#endif + #endif // BOOST_CHRONO_TIME_POINT_HPP |