Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58236 - in sandbox/chrono: boost boost/chrono boost/type_traits libs/chrono/build libs/chrono/doc libs/chrono/doc/html libs/chrono/doc/html/boost_chrono libs/chrono/doc/html/boost_chrono/appendices libs/chrono/doc/html/boost_chrono/examples libs/chrono/doc/html/boost_chrono/overview libs/chrono/doc/html/boost_chrono/reference libs/chrono/doc/html/boost_chrono/users_guide libs/chrono/example libs/chrono/src libs/chrono/src/mac libs/chrono/src/posix libs/chrono/src/win libs/chrono/test
From: vicente.botet_at_[hidden]
Date: 2009-12-08 07:54:04


Author: viboes
Date: 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
New Revision: 58236
URL: http://svn.boost.org/trac/boost/changeset/58236

Log:
Boost.Chrono: Version 0.2.0, Features + Bug fixes + Updated documentation
 Features:

    * Added ratio construction and assignment from an equivalent ratio.
    * Added nested ratio typedef type.
    * Added BOOST_CHRONO_HAS_CLOCK_MONOTONIC macro to state if monotonic_clock is provided on this platform.
    * Added duration operator%
    * Added BOOST_CONSTEXPR when constexpr should be used
    * Complete duration operator* and operator/

Implementation:

    * Separate chrono.cpp on # files win/chrono.cpp, mac/chrono.cpp and posix/chrono.cpp to make easier the maintenance on different platforms.
    * Separate process_clock.cpp on # files win/process_clock.cpp, mac/process_clock.cpp and posix/process_clock.cpp to make easier the maintenance on different platforms.
    * Added the error_code prototype for monotonic_clock::now for mac/chrono.cpp
    * Fully implement mac/chrono.cpp with error handling.
    * Take care on POSIX systems when CLOCK_MONOTONIC is not defined.

Documentation:

    * The documentation is written now using quick-book using as base N2661 - A Foundation to Sleep On .

Bugs

    * operator/ was ambiguous: Disambiguate duration operator/
    * CLOCK_MONOTONIC is not defined with cygwin/gcc 3.4: Disable code when BOOST_CHRONO_HAS_CLOCK_MONOTONIC is not defined.
    * result of ratio_add and ratio_add were not normalized ratios: Use of the nested ratio typedef type on ratio arithmetic operations.
    * Copy constructor from similar duration masked the defaulted operations: Added duration defaulted implementations

Added:
   sandbox/chrono/libs/chrono/doc/Jamfile.v2 (contents, props changed)
   sandbox/chrono/libs/chrono/doc/chrono.qbk (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/acknowledgements.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/appendix_e__tests.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/appendix_f__tickets.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/history.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/implementation.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/rationale.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/todo.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/a_tiny_program_that_times_how_long_until_a_key_is_struck.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/howard_hinnant_s_original_demonstration_program.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/howard_hinnant_s_simulated_thread_interface_demonstration_program.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/run_timer_example2_cpp.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/run_timer_example_cpp.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/saturating.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/si_units.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/overview/
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/overview.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/overview/motivation.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/chrono_hpp.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/common_type_hpp.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/process_times_hpp.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/ratio_hpp.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/timer_hpp.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/users_guide/
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/users_guide.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/users_guide/ext_references.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/users_guide/getting_started.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/users_guide/tutorial.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/index.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/standalone_HTML.manifest (contents, props changed)
   sandbox/chrono/libs/chrono/example/cycle_count.cpp (contents, props changed)
   sandbox/chrono/libs/chrono/example/i_dont_like_the_default_duration_behavior.cpp (contents, props changed)
   sandbox/chrono/libs/chrono/example/min_time_point.cpp (contents, props changed)
   sandbox/chrono/libs/chrono/example/runtime_resolution.cpp (contents, props changed)
   sandbox/chrono/libs/chrono/example/saturating.cpp (contents, props changed)
   sandbox/chrono/libs/chrono/example/simulated_thread_interface_demo.cpp (contents, props changed)
   sandbox/chrono/libs/chrono/example/timeval_demo.cpp (contents, props changed)
   sandbox/chrono/libs/chrono/example/xtime.cpp (contents, props changed)
   sandbox/chrono/libs/chrono/src/mac/
   sandbox/chrono/libs/chrono/src/mac/chrono.cpp (contents, props changed)
   sandbox/chrono/libs/chrono/src/mac/process_clock.cpp (contents, props changed)
   sandbox/chrono/libs/chrono/src/posix/
   sandbox/chrono/libs/chrono/src/posix/chrono.cpp (contents, props changed)
   sandbox/chrono/libs/chrono/src/posix/process_clock.cpp (contents, props changed)
   sandbox/chrono/libs/chrono/src/win/
   sandbox/chrono/libs/chrono/src/win/chrono.cpp (contents, props changed)
   sandbox/chrono/libs/chrono/src/win/process_clock.cpp (contents, props changed)
Text files modified:
   sandbox/chrono/boost/chrono/chrono.hpp | 266 ++++++++++++++++++++--------------
   sandbox/chrono/boost/chrono/config.hpp | 18 ++
   sandbox/chrono/boost/chrono/timer.hpp | 3
   sandbox/chrono/boost/ratio.hpp | 109 ++++++++++---
   sandbox/chrono/boost/type_traits/common_type.hpp | 9 +
   sandbox/chrono/libs/chrono/build/Jamfile.v2 | 15 +
   sandbox/chrono/libs/chrono/src/chrono.cpp | 302 ---------------------------------------
   sandbox/chrono/libs/chrono/src/process_clock.cpp | 111 ++------------
   sandbox/chrono/libs/chrono/test/Jamfile.v2 | 66 +++++--
   sandbox/chrono/libs/chrono/test/chrono_unit_test.cpp | 2
   sandbox/chrono/libs/chrono/test/ratio_fail_test1.cpp | 7
   sandbox/chrono/libs/chrono/test/ratio_test.cpp | 53 +++++++
   sandbox/chrono/libs/chrono/test/run_timer_test.cpp | 9 +
   13 files changed, 415 insertions(+), 555 deletions(-)

Modified: sandbox/chrono/boost/chrono/chrono.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/chrono.hpp (original)
+++ sandbox/chrono/boost/chrono/chrono.hpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -2,6 +2,7 @@
 
 // Copyright 2008 Howard Hinnant
 // Copyright 2008 Beman Dawes
+// Copyright 2009 Vicente J. Botet Escriba
 
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt
@@ -63,6 +64,12 @@
 #include <limits>
 
 #include <boost/chrono/config.hpp>
+#if defined(BOOST_NO_CONSTEXPR)
+#define BOOST_CONSTEXPR
+#else
+#define BOOST_CONSTEXPR constexpr
+#endif
+
 #include <boost/ratio.hpp>
 #include <boost/type_traits/common_type.hpp>
 #include <boost/system/error_code.hpp>
@@ -95,8 +102,48 @@
   template <class Clock, class Duration = typename Clock::duration>
     class time_point;
 
+ namespace detail
+ {
+ template <class T>
+ struct is_duration
+ : boost::false_type {};
+
+ template <class Rep, class Period>
+ struct is_duration<duration<Rep, Period> >
+ : boost::true_type {};
+ //template <class T>
+ // struct is_duration
+ // : is_duration<typename boost::remove_cv<T>::type> {};
+
+ template <class Duration, class Rep, bool = is_duration<Rep>::value>
+ struct duration_divide_result
+ {
+ };
+
+ template <class Duration, class Rep2,
+ bool = boost::is_convertible<typename Duration::rep,
+ typename common_type<typename Duration::rep, Rep2>::type>::value
+ && boost::is_convertible<Rep2,
+ typename common_type<typename Duration::rep, Rep2>::type>::value>
+ struct duration_divide_imp
+ {
+ };
+
+ template <class Rep1, class Period, class Rep2>
+ struct duration_divide_imp<duration<Rep1, Period>, Rep2, true>
+ {
+ typedef duration<typename common_type<Rep1, Rep2>::type, Period> type;
+ };
+
+ template <class Rep1, class Period, class Rep2>
+ struct duration_divide_result<duration<Rep1, Period>, Rep2, false>
+ : duration_divide_imp<duration<Rep1, Period>, Rep2>
+ {
+ };
+ } // namespace detail
 } // namespace chrono
 
+
 // common_type trait specializations
 
 template <class Rep1, class Period1, class Rep2, class Period2>
@@ -120,15 +167,29 @@
   template <class Rep1, class Period1, class Rep2, class Period2>
     typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2> >::type
     operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
- //template <class Rep1, class Period, class Rep2>
- // duration<typename common_type<Rep1, Rep2>::type, Period>
- // operator*(const duration<Rep1, Period>& d, const Rep2& s);
   template <class Rep1, class Period, class Rep2>
- duration<typename common_type<Rep1, Rep2>::type, Period>
+ typename boost::enable_if_c
+ <
+ boost::is_convertible<Rep1, typename common_type<Rep1, Rep2>::type>::value
+ && boost::is_convertible<Rep2, typename common_type<Rep1, Rep2>::type>::value,
+ duration<typename common_type<Rep1, Rep2>::type, Period>
+ >::type
+ operator*(const duration<Rep1, Period>& d, const Rep2& s);
+ template <class Rep1, class Period, class Rep2>
+ typename boost::enable_if_c
+ <
+ boost::is_convertible<Rep1, typename common_type<Rep1, Rep2>::type>::value
+ && boost::is_convertible<Rep2, typename common_type<Rep1, Rep2>::type>::value,
+ duration<typename common_type<Rep1, Rep2>::type, Period>
+ >::type
     operator*(const Rep1& s, const duration<Rep2, Period>& d);
- //template <class Rep1, class Period, class Rep2>
- // duration<typename common_type<Rep1, Rep2>::type, Period>
- // operator/(const duration<Rep1, Period>& d, const Rep2& s);
+
+ template <class Rep1, class Period, class Rep2>
+ typename boost::disable_if <detail::is_duration<Rep2>,
+ typename detail::duration_divide_result<duration<Rep1, Period>, Rep2>::type
+ >::type
+ operator/(const duration<Rep1, Period>& d, const Rep2& s);
+
   template <class Rep1, class Period1, class Rep2, class Period2>
     typename common_type<Rep1, Rep2>::type
     operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
@@ -201,26 +262,21 @@
 
   // Clocks
   class BOOST_CHRONO_DECL system_clock;
- class BOOST_CHRONO_DECL monotonic_clock;
- typedef monotonic_clock high_resolution_clock; // as permitted by [time.clock.hires]
+#ifdef BOOST_CHRONO_HAS_CLOCK_MONOTONIC
+ class BOOST_CHRONO_DECL monotonic_clock; // as permitted by [time.clock.monotonic]
+#endif
 
+#ifdef BOOST_CHRONO_HAS_CLOCK_MONOTONIC
+ typedef monotonic_clock high_resolution_clock; // as permitted by [time.clock.hires]
+#else
+ typedef system_clock high_resolution_clock; // as permitted by [time.clock.hires]
+#endif
 //----------------------------------------------------------------------------//
 // duration helpers //
 //----------------------------------------------------------------------------//
 
   namespace detail
   {
- template <class T>
- struct is_duration
- : boost::false_type {};
-
- template <class Rep, class Period>
- struct is_duration<duration<Rep, Period> >
- : boost::true_type {};
-
- //template <class T>
- // struct is_duration
- // : is_duration<typename boost::remove_cv<T>::type> {};
 
     // duration_cast
 
@@ -359,12 +415,12 @@
   template <class Rep>
   struct duration_values
   {
- static Rep m_min_imp(boost::false_type) {return -max();}
- static Rep m_min_imp(boost::true_type) {return zero();}
+ static BOOST_CONSTEXPR Rep m_min_imp(boost::false_type) {return -max();}
+ static BOOST_CONSTEXPR Rep m_min_imp(boost::true_type) {return zero();}
   public:
- static Rep zero() {return Rep(0);}
- static Rep max() {return std::numeric_limits<Rep>::max();}
- static Rep min() {return m_min_imp(boost::is_unsigned<Rep>());}
+ static BOOST_CONSTEXPR Rep zero() {return Rep(0);}
+ static BOOST_CONSTEXPR Rep max() {return std::numeric_limits<Rep>::max();}
+ static BOOST_CONSTEXPR Rep min() {return m_min_imp(boost::is_unsigned<Rep>());}
   };
 
 } // namespace chrono
@@ -397,25 +453,25 @@
 
 namespace chrono {
 
- template <class Rep, class Period>
- class duration
- {
- // static char test0[!detail::is_duration<Rep>];
- //// static_assert(!detail::is_duration<Rep>, "A duration representation can not be a duration");
- // static char test1[detail::is_ratio<Period>];
- //// static_assert(detail::is_ratio<Period>::value, "Second template parameter of duration must be a std::ratio");
- // static char test2[Period::num > 0];
- //// static_assert(Period::num > 0, "duration period must be positive");
- public:
- typedef Rep rep;
- typedef Period period;
- private:
- rep rep_;
- public:
-
- duration() {} // = default;
- template <class Rep2>
- explicit duration(const Rep2& r,
+ template <class Rep, class Period>
+ class duration
+ {
+ // static char test0[!detail::is_duration<Rep>];
+ //// static_assert(!detail::is_duration<Rep>, "A duration representation can not be a duration");
+ // static char test1[detail::is_ratio<Period>];
+ //// static_assert(detail::is_ratio<Period>::value, "Second template parameter of duration must be a std::ratio");
+ // static char test2[Period::num > 0];
+ //// static_assert(Period::num > 0, "duration period must be positive");
+ public:
+ typedef Rep rep;
+ typedef Period period;
+ private:
+ rep rep_;
+ public:
+
+ BOOST_CONSTEXPR duration() {} // = default;
+ template <class Rep2>
+ BOOST_CONSTEXPR explicit duration(const Rep2& r,
               typename boost::enable_if_c
               <
               boost::is_convertible<Rep2, rep>::value
@@ -424,10 +480,17 @@
                    && !treat_as_floating_point<Rep2>::value))
>::type* = 0)
                   : rep_(r) {}
-
- // conversions
- template <class Rep2, class Period2>
- duration(const duration<Rep2, Period2>& d,
+ ~duration() {} //= default;
+ duration(const duration& rhs) : rep_(rhs.rep_) {} // = default;
+ duration& operator=(const duration& rhs) // = default;
+ {
+ if (rhs != *this) rep_= rhs.rep_;
+ return *this;
+ }
+
+ // conversions
+ template <class Rep2, class Period2>
+ BOOST_CONSTEXPR duration(const duration<Rep2, Period2>& d,
               typename boost::enable_if_c
               <
                   treat_as_floating_point<rep>::value
@@ -435,41 +498,42 @@
                     && !treat_as_floating_point<Rep2>::value)
>::type* = 0)
 #ifdef __GNUC__
- // GCC 4.2.4 refused to accept a definition at this point,
- // yet both VC++ 9.0 SP1 and Intel ia32 11.0 accepted the definition
- // without complaint. VC++ 9.0 SP1 refused to accept a later definition,
- // although that was fine with GCC 4.2.4 and Intel ia32 11.0. Thus we
- // have to support both approaches.
- ;
+ // GCC 4.2.4 refused to accept a definition at this point,
+ // yet both VC++ 9.0 SP1 and Intel ia32 11.0 accepted the definition
+ // without complaint. VC++ 9.0 SP1 refused to accept a later definition,
+ // although that was fine with GCC 4.2.4 and Intel ia32 11.0. Thus we
+ // have to support both approaches.
+ ;
 #else
- : rep_(duration_cast<duration>(d).count()) {}
+ : rep_(duration_cast<duration>(d).count()) {}
 #endif
+
+ // observer
 
- // observer
-
- rep count() const {return rep_;}
+ BOOST_CONSTEXPR rep count() const {return rep_;}
 
- // arithmetic
+ // arithmetic
 
- duration operator+() const {return *this;}
- duration operator-() const {return duration(-rep_);}
- duration& operator++() {++rep_; return *this;}
- duration operator++(int) {return duration(rep_++);}
- duration& operator--() {--rep_; return *this;}
- duration operator--(int) {return duration(rep_--);}
-
- duration& operator+=(const duration& d) {rep_ += d.count(); return *this;}
- duration& operator-=(const duration& d) {rep_ -= d.count(); return *this;}
-
- duration& operator*=(const rep& rhs) {rep_ *= rhs; return *this;}
- duration& operator/=(const rep& rhs) {rep_ /= rhs; return *this;}
-
- // 20.9.3.4 duration special values [time.duration.special]
-
- static duration zero() {return duration(duration_values<rep>::zero());}
- static duration min() {return duration(duration_values<rep>::min());}
- static duration max() {return duration(duration_values<rep>::max());}
- };
+ duration operator+() const {return *this;}
+ duration operator-() const {return duration(-rep_);}
+ duration& operator++() {++rep_; return *this;}
+ duration operator++(int) {return duration(rep_++);}
+ duration& operator--() {--rep_; return *this;}
+ duration operator--(int) {return duration(rep_--);}
+
+ duration& operator+=(const duration& d) {rep_ += d.count(); return *this;}
+ duration& operator-=(const duration& d) {rep_ -= d.count(); return *this;}
+
+ duration& operator*=(const rep& rhs) {rep_ *= rhs; return *this;}
+ duration& operator/=(const rep& rhs) {rep_ /= rhs; return *this;}
+ duration& operator%=(const rep& rhs) {rep_ %= rhs; return *this;}
+ duration& operator%=(const duration& rhs) {rep_ %= rhs.count(); return *this;};
+ // 20.9.3.4 duration special values [time.duration.special]
+
+ static BOOST_CONSTEXPR duration zero() {return duration(duration_values<rep>::zero());}
+ static BOOST_CONSTEXPR duration min() {return duration(duration_values<rep>::min());}
+ static BOOST_CONSTEXPR duration max() {return duration(duration_values<rep>::max());}
+ };
 
 //----------------------------------------------------------------------------//
 // 20.9.3.5 duration non-member arithmetic [time.duration.nonmember] //
@@ -534,38 +598,14 @@
 
   // Duration /
 
- namespace detail
- {
- template <class Duration, class Rep, bool = is_duration<Rep>::value>
- struct duration_divide_result
- {
- };
-
- template <class Duration, class Rep2,
- bool = boost::is_convertible<typename Duration::rep,
- typename common_type<typename Duration::rep, Rep2>::type>::value
- && boost::is_convertible<Rep2,
- typename common_type<typename Duration::rep, Rep2>::type>::value>
- struct duration_divide_imp
- {
- };
-
- template <class Rep1, class Period, class Rep2>
- struct duration_divide_imp<duration<Rep1, Period>, Rep2, true>
- {
- typedef duration<typename common_type<Rep1, Rep2>::type, Period> type;
- };
 
- template <class Rep1, class Period, class Rep2>
- struct duration_divide_result<duration<Rep1, Period>, Rep2, false>
- : duration_divide_imp<duration<Rep1, Period>, Rep2>
- {
- };
- } // namespace detail
 
   template <class Rep1, class Period, class Rep2>
   inline
+ typename boost::disable_if <detail::is_duration<Rep2>,
+ //duration<typename common_type<Rep1, Rep2>::type, Period>
   typename detail::duration_divide_result<duration<Rep1, Period>, Rep2>::type
+ >::type
   operator/(const duration<Rep1, Period>& d, const Rep2& s)
   {
       typedef typename common_type<Rep1, Rep2>::type CR;
@@ -743,8 +783,8 @@
 
       // special values
 
- static time_point min() {return time_point(duration::min());}
- static time_point max() {return time_point(duration::max());}
+ static BOOST_CONSTEXPR time_point min() {return time_point(duration::min());}
+ static BOOST_CONSTEXPR time_point max() {return time_point(duration::max());}
   };
 
 //----------------------------------------------------------------------------//
@@ -919,6 +959,10 @@
 // 20.9.5.2 Class monotonic_clock [time.clock.monotonic] //
 //----------------------------------------------------------------------------//
 
+// As permitted by [time.clock.monotonic]
+// The class monotonic_clock is conditionally supported.
+
+#ifdef BOOST_CHRONO_HAS_CLOCK_MONOTONIC
   class BOOST_CHRONO_DECL monotonic_clock
   {
   public:
@@ -931,12 +975,12 @@
       static time_point now(); // throws on error
       static time_point now(system::error_code & ec); // never throws
   };
-
+#endif
 //----------------------------------------------------------------------------//
 // 20.9.5.3 Class high_resolution_clock [time.clock.hires] //
 //----------------------------------------------------------------------------//
 
-// As permitted, monotonic_clock is a typedef for high_resolution_clock.
+// As permitted, monotonic_clock or system_clock is a typedef for high_resolution_clock.
 // See synopsis.
 
 
@@ -949,7 +993,7 @@
   // see comment above in section 20.9.3 Class template duration [time.duration]
   template <class Rep, class Period>
   template <class Rep2, class Period2>
- duration<Rep, Period>::duration(const duration<Rep2, Period2>& d,
+ BOOST_CONSTEXPR duration<Rep, Period>::duration(const duration<Rep2, Period2>& d,
           typename boost::enable_if_c
           <
               treat_as_floating_point<rep>::value
@@ -964,4 +1008,6 @@
 
 #include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas
 
+#undef BOOST_CONSTEXPR
+
 #endif // BOOST_CHRONO_HPP

Modified: sandbox/chrono/boost/chrono/config.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/config.hpp (original)
+++ sandbox/chrono/boost/chrono/config.hpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -1,6 +1,7 @@
 // boost/chrono/config.hpp -------------------------------------------------//
 
 // Copyright Beman Dawes 2003, 2006, 2008
+// Copyright 2009 Vicente J. Botet Escriba
 
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -32,13 +33,28 @@
 # elif !defined( BOOST_CHRONO_WINDOWS_API ) && !defined( BOOST_CHRONO_MAC_API ) && !defined( BOOST_CHRONO_POSIX_API )
 # if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32))
 # define BOOST_CHRONO_WINDOWS_API
+# define BOOST_HAS_CLOCK_MONOTONIC
 # elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
 # define BOOST_CHRONO_MAC_API
+# define BOOST_CHRONO_HAS_CLOCK_MONOTONIC
 # else
-# define BOOST_CHRONO_POSIX_API
+# define BOOST_CHRONO_POSIX_API
 # endif
 # endif
 
+# if defined( BOOST_CHRONO_POSIX_API )
+# include <time.h> //to check for CLOCK_REALTIME and CLOCK_MONOTONIC
+# if defined(CLOCK_REALTIME)
+# if defined(CLOCK_MONOTONIC)
+# define BOOST_CHRONO_HAS_CLOCK_MONOTONIC
+# endif
+# else
+# error <time.h> does not supply CLOCK_REALTIME
+# endif
+# endif
+
+
+
 // enable dynamic linking on Windows ---------------------------------------//
 
 //# if (defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CHRONO_DYN_LINK)) && defined(__BORLANDC__) && defined(__WIN32__)

Modified: sandbox/chrono/boost/chrono/timer.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/timer.hpp (original)
+++ sandbox/chrono/boost/chrono/timer.hpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -1,6 +1,7 @@
 // boost/chrono/timer.hpp ------------------------------------------------------------//
 
 // Copyright Beman Dawes 2008
+// Copyright 2009 Vicente J. Botet Escriba
 
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -46,7 +47,9 @@
     };
 
     typedef boost::chrono::timer< boost::chrono::system_clock > system_timer;
+#ifdef BOOST_CHRONO_HAS_CLOCK_MONOTONIC
     typedef boost::chrono::timer< boost::chrono::monotonic_clock > monotonic_timer;
+#endif
     typedef boost::chrono::timer< boost::chrono::high_resolution_clock > high_resolution_timer;
 
   } // namespace chrono

Modified: sandbox/chrono/boost/ratio.hpp
==============================================================================
--- sandbox/chrono/boost/ratio.hpp (original)
+++ sandbox/chrono/boost/ratio.hpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -2,6 +2,7 @@
 
 // Copyright 2008 Howard Hinnant
 // Copyright 2008 Beman Dawes
+// Copyright 2009 Vicente J. Botet Escriba
 
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt
@@ -10,7 +11,7 @@
 
 This code was derived by Beman Dawes from Howard Hinnant's time2_demo prototype.
 Many thanks to Howard for making his code available under the Boost license.
-The original code was modified to conform to Boost conventions and to section
+The original code was modified to conform to Boost conventions and to section
 20.4 Compile-time rational arithmetic [ratio], of the C++ committee working
 paper N2798.
 See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf.
@@ -34,6 +35,7 @@
 #include <limits>
 #include <boost/cstdint.hpp>
 #include <boost/type_traits.hpp>
+#include <boost/utility/enable_if.hpp>
 
 namespace boost
 {
@@ -61,22 +63,22 @@
 template <class R1, class R2> struct ratio_greater_equal;
 
 // convenience SI typedefs
-typedef ratio<1LL, 1000000000000000000LL> atto;
-typedef ratio<1LL, 1000000000000000LL> femto;
-typedef ratio<1LL, 1000000000000LL> pico;
-typedef ratio<1LL, 1000000000LL> nano;
-typedef ratio<1LL, 1000000LL> micro;
-typedef ratio<1LL, 1000LL> milli;
-typedef ratio<1LL, 100LL> centi;
-typedef ratio<1LL, 10LL> deci;
-typedef ratio< 10LL, 1LL> deca;
-typedef ratio< 100LL, 1LL> hecto;
-typedef ratio< 1000LL, 1LL> kilo;
-typedef ratio< 1000000LL, 1LL> mega;
-typedef ratio< 1000000000LL, 1LL> giga;
-typedef ratio< 1000000000000LL, 1LL> tera;
-typedef ratio< 1000000000000000LL, 1LL> peta;
-typedef ratio<1000000000000000000LL, 1LL> exa;
+typedef ratio<INTMAX_C(1), INTMAX_C(1000000000000000000)> atto;
+typedef ratio<INTMAX_C(1), INTMAX_C(1000000000000000)> femto;
+typedef ratio<INTMAX_C(1), INTMAX_C(1000000000000)> pico;
+typedef ratio<INTMAX_C(1), INTMAX_C(1000000000)> nano;
+typedef ratio<INTMAX_C(1), INTMAX_C(1000000)> micro;
+typedef ratio<INTMAX_C(1), INTMAX_C(1000)> milli;
+typedef ratio<INTMAX_C(1), INTMAX_C(100)> centi;
+typedef ratio<INTMAX_C(1), INTMAX_C(10)> deci;
+typedef ratio< INTMAX_C(10), INTMAX_C(1)> deca;
+typedef ratio< INTMAX_C(100), INTMAX_C(1)> hecto;
+typedef ratio< INTMAX_C(1000), INTMAX_C(1)> kilo;
+typedef ratio< INTMAX_C(1000000), INTMAX_C(1)> mega;
+typedef ratio< INTMAX_C(1000000000), INTMAX_C(1)> giga;
+typedef ratio< INTMAX_C(1000000000000), INTMAX_C(1)> tera;
+typedef ratio< INTMAX_C(1000000000000000), INTMAX_C(1)> peta;
+typedef ratio<INTMAX_C(1000000000000000000), INTMAX_C(1)> exa;
 
 //----------------------------------------------------------------------------//
 // helpers //
@@ -271,12 +273,35 @@
 // static_assert(detail::static_abs<D>::value > 0, "ratio denominator is out of range");
     static const boost::intmax_t m_na = detail::static_abs<N>::value;
     static const boost::intmax_t m_da = detail::static_abs<D>::value;
- static const boost::intmax_t m_s = detail::static_sign<N>::value
+ static const boost::intmax_t m_s = detail::static_sign<N>::value
       * detail::static_sign<D>::value;
     static const boost::intmax_t m_gcd = detail::static_gcd<m_na, m_da>::value;
 public:
     static const boost::intmax_t num = m_s * m_na / m_gcd;
     static const boost::intmax_t den = m_da / m_gcd;
+
+#if 1
+ ratio() {}
+
+ template <intmax_t _N2, intmax_t _D2>
+ ratio(const ratio<_N2, _D2>&,
+ typename enable_if_c
+ <
+ ratio<_N2, _D2>::num == num &&
+ ratio<_N2, _D2>::den == den
+ >::type* = 0) {}
+
+ template <intmax_t _N2, intmax_t _D2>
+ typename enable_if_c
+ <
+ ratio<_N2, _D2>::num == num &&
+ ratio<_N2, _D2>::den == den,
+ ratio&
+ >::type
+ operator=(const ratio<_N2, _D2>&) {return *this;}
+#endif
+
+ typedef ratio<num, den> type;
 };
 
 //----------------------------------------------------------------------------//
@@ -289,10 +314,19 @@
 struct ratio_add
 {
 private:
- static const boost::intmax_t gcd_n1_n2 = detail::static_gcd<R1::num, R2::num>::value;
- static const boost::intmax_t gcd_d1_d2 = detail::static_gcd<R1::den, R2::den>::value;
+#if 1
+#else
+ static const boost::intmax_t gcd_n1_n2 = detail::static_gcd<R1::num, R2::num>::value;
+ static const boost::intmax_t gcd_d1_d2 = detail::static_gcd<R1::den, R2::den>::value;
+#endif
 public:
- typedef typename ratio_multiply
+ //The nested typedef type shall be a synonym for ratio<T1, T2> where T1 has the value R1::num *
+ //R2::den + R2::num * R1::den and T2 has the value R1::den * R2::den.
+#if 1
+ typedef typename ratio<R1::num * R2::den + R2::num * R1::den,R1::den * R2::den>::type type;
+ //typedef ratio<aux_type::num ,aux_type::den > type;
+#else
+ typedef typename ratio_multiply
        <
            ratio<gcd_n1_n2, R1::den / gcd_d1_d2>,
            ratio
@@ -305,16 +339,26 @@
                R2::den
>
>::type type;
+#endif
 };
 
 template <class R1, class R2>
 struct ratio_subtract
 {
 private:
- static const boost::intmax_t gcd_n1_n2 = detail::static_gcd<R1::num, R2::num>::value;
- static const boost::intmax_t gcd_d1_d2 = detail::static_gcd<R1::den, R2::den>::value;
+#if 1
+#else
+ static const boost::intmax_t gcd_n1_n2 = detail::static_gcd<R1::num, R2::num>::value;
+ static const boost::intmax_t gcd_d1_d2 = detail::static_gcd<R1::den, R2::den>::value;
+#endif
 public:
- typedef typename ratio_multiply
+//The nested typedef type shall be a synonym for ratio<T1, T2> where T1 has the value
+// R1::num *R2::den - R2::num * R1::den and T2 has the value R1::den * R2::den.
+#if 1
+ typedef typename ratio<R1::num * R2::den - R2::num * R1::den,R1::den * R2::den>::type type;
+ //typedef ratio<aux_type::num ,aux_type::den > type;
+#else
+ typedef typename ratio_multiply
        <
            ratio<gcd_n1_n2, R1::den / gcd_d1_d2>,
            ratio
@@ -327,34 +371,47 @@
                R2::den
>
>::type type;
+#endif
 };
 
 template <class R1, class R2>
 struct ratio_multiply
 {
 private:
+#if 0
    static const boost::intmax_t gcd_n1_d2 = detail::static_gcd<R1::num, R2::den>::value;
    static const boost::intmax_t gcd_d1_n2 = detail::static_gcd<R1::den, R2::num>::value;
+#endif
 public:
+#if 0
    typedef ratio
        <
            detail::ll_mul<R1::num / gcd_n1_d2, R2::num / gcd_d1_n2>::value,
            detail::ll_mul<R2::den / gcd_n1_d2, R1::den / gcd_d1_n2>::value
> type;
+#else
+ typedef typename ratio<R1::num * R2::num, R1::den * R2::den>::type type;
+#endif
 };
 
 template <class R1, class R2>
 struct ratio_divide
 {
 private:
+#if 0
    static const boost::intmax_t gcd_n1_n2 = detail::static_gcd<R1::num, R2::num>::value;
    static const boost::intmax_t gcd_d1_d2 = detail::static_gcd<R1::den, R2::den>::value;
+#endif
 public:
+#if 0
    typedef ratio
        <
            detail::ll_mul<R1::num / gcd_n1_n2, R2::den / gcd_d1_d2>::value,
            detail::ll_mul<R2::num / gcd_n1_n2, R1::den / gcd_d1_d2>::value
> type;
+#else
+ typedef typename ratio<R1::num * R2::den, R1::den * R2::num>::type type;
+#endif
 };
 
 // ratio_equal
@@ -362,11 +419,11 @@
 template <class R1, class R2>
 struct ratio_equal
     : public boost::integral_constant<bool,
- R1::num == R2::num && R1::den == R2::den> {};
+ R1::num == R2::num && R1::den == R2::den> {};
 
 template <class R1, class R2>
 struct ratio_not_equal
- : public boost::integral_constant<bool, !ratio_equal<R1, R2>::value> {};
+ : public boost::integral_constant<bool, !ratio_equal<R1, R2>::value> {};
 
 // ratio_less
 

Modified: sandbox/chrono/boost/type_traits/common_type.hpp
==============================================================================
--- sandbox/chrono/boost/type_traits/common_type.hpp (original)
+++ sandbox/chrono/boost/type_traits/common_type.hpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -33,6 +33,14 @@
      typedef typename common_type<typename common_type<T, U>::type, V>::type type;
   };
 
+namespace detail {
+template<typename A, typename B>
+struct result_of_conditional
+{
+ static bool m_f(); // workaround gcc bug; not required by std
+ typedef BOOST_TYPEOF_TPL(m_f()?A():B()) type;
+};
+}
 
   template <class T>
   struct common_type<T, void, void>
@@ -49,6 +57,7 @@
      static U m_u();
      static bool m_f(); // workaround gcc bug; not required by std
   public:
+
      typedef BOOST_TYPEOF_TPL(m_f() ? m_t() : m_u()) type;
   };
 

Modified: sandbox/chrono/libs/chrono/build/Jamfile.v2
==============================================================================
--- sandbox/chrono/libs/chrono/build/Jamfile.v2 (original)
+++ sandbox/chrono/libs/chrono/build/Jamfile.v2 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -7,7 +7,17 @@
 
 # See library home page at http://www.boost.org/libs/chrono
 
+if ! $(BOOST_ROOT)
+{
+ BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ;
+}
+
 project boost/chrono
+ : requirements
+ <include>/boost_1_39_0
+ <include>../../..
+ <include>../src
+ #<library>/boost_1_39_0/libs/system/build//boost_system
     : source-location ../src
     : usage-requirements # pass these requirement to dependents (i.e. users)
       <link>shared:<define>BOOST_CHRONO_DYN_LINK=1
@@ -16,11 +26,10 @@
 
 SOURCES = chrono process_clock run_timer run_timer_static ;
 
-lib boost_chrono
+static-lib boost_chrono
    : $(SOURCES).cpp
- ../../system/build//boost_system
    : <link>shared:<define>BOOST_ALL_DYN_LINK=1
      <link>static:<define>BOOST_All_STATIC_LINK=1
    ;
 
-boost-install boost_chrono ;
\ No newline at end of file
+#boost-install boost_chrono ;
\ No newline at end of file

Added: sandbox/chrono/libs/chrono/doc/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/Jamfile.v2 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,72 @@
+# Boost.Chrono library documentation Jamfile ---------------------------------
+#
+# Copyright Vicente J. Botet Escriba 2009. Use, modification and
+# distribution is subject to the Boost Software License, Version
+# 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+#
+# See http://www.boost.org for updates, documentation, and revision history.
+
+#import doxygen ;
+import quickbook ;
+
+#doxygen autodoc
+# :
+# [ glob ../../../boost/chrono/*.hpp ]
+# [ glob ../../../boost/chrono/allocators/*.hpp ]
+# :
+# <doxygen:param>EXTRACT_ALL=NO
+# <doxygen:param>HIDE_UNDOC_MEMBERS=YES
+# <doxygen:param>EXTRACT_PRIVATE=NO
+# <doxygen:param>EXPAND_ONLY_PREDEF=YES
+# <doxygen:param>PREDEFINED=BOOST_INTERPROCESS_DOXYGEN_INVOKED
+# <xsl:param>"boost.doxygen.reftitle=Boost.Chrono Reference"
+# ;
+
+xml chrono : chrono.qbk ;
+
+boostbook standalone
+ :
+ chrono
+ :
+ # HTML options first:
+ # Use graphics not text for navigation:
+ <xsl:param>navig.graphics=1
+ # How far down we chunk nested sections, basically all of them:
+ <xsl:param>chunk.section.depth=2
+ # Don't put the first section on the same page as the TOC:
+ <xsl:param>chunk.first.sections=1
+ # How far down sections get TOC's
+ <xsl:param>toc.section.depth=4
+ # Max depth in each TOC:
+ <xsl:param>toc.max.depth=2
+ # How far down we go with TOC's
+ <xsl:param>generate.section.toc.level=10
+ # Path for links to Boost:
+ <xsl:param>boost.root=../../../..
+ # Path for libraries index:
+ <xsl:param>boost.libraries=../../../../libs/libraries.htm
+ # Use the main Boost stylesheet:
+ <xsl:param>html.stylesheet=../../../../doc/html/boostbook.css
+
+ # PDF Options:
+ # TOC Generation: this is needed for FOP-0.9 and later:
+ #<xsl:param>fop1.extensions=1
+ # Or enable this if you're using XEP:
+ <xsl:param>xep.extensions=1
+ # TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9!
+ <xsl:param>fop.extensions=0
+ # No indent on body text:
+ <xsl:param>body.start.indent=0pt
+ # Margin size:
+ <xsl:param>page.margin.inner=0.5in
+ # Margin size:
+ <xsl:param>page.margin.outer=0.5in
+ # Yes, we want graphics for admonishments:
+ <xsl:param>admon.graphics=1
+ # Set this one for PDF generation *only*:
+ # default pnd graphics are awful in PDF form,
+ # better use SVG's instead:
+ <format>pdf:<xsl:param>admon.graphics.extension=".svg"
+ <format>pdf:<xsl:param>admon.graphics.path=$(boost-images)/
+ ;

Added: sandbox/chrono/libs/chrono/doc/chrono.qbk
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/chrono.qbk 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,2174 @@
+[/
+ / Copyright (c) 2008 Howard Hinnant
+ / Copyright (c) 2006, 2008 Beman Dawes
+ / Copyright (c) 2009 Vicente J. Botet Escriba
+ /
+ / Distributed under the Boost Software License, Version 1.0. (See accompanying
+ / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ /]
+
+[article Boost.Chrono
+ [quickbook 1.3]
+ [authors [Hinnant, Howard]]
+ [authors [Dawes, Beman]]
+ [authors [Botet Escriba, Vicente J.]]
+ [copyright 2008 Howard Hinnant]
+ [copyright 2006, 2008 Beman Dawes]
+ [copyright 2009 Vicente J. Botet Escriba]
+ [purpose Time utilities]
+ [license
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ [@http://www.boost.org/LICENSE_1_0.txt])
+ ]
+]
+
+[/
+[section Preface]
+
+[:[".]]
+[:[*['-- ]]]
+
+[endsect]
+/]
+
+[warning Chrono is not part of the Boost libraries.]
+
+[/===============]
+[section Overview]
+[/===============]
+
+[/==================]
+[heading Description]
+[/==================]
+
+The Boost Chrono library provides:
+
+* The C++0x Standard Library's `common_type`.
+* The C++0x Standard Library's compile-time rational arithmetic.
+* The C++0x Standard Library's time utilities, including:
+ * Class template `duration`
+ * Class template `time_point`
+ * Clocks:
+ * `system_clock`
+ * `monotonic_clock`
+ * `high_resolution_clock`
+
+* Class template timer, with typedefs:
+ * `system_timer`
+ * `monotonic_timer`
+ * `high_resolution_timer`
+
+* Process clocks and timers:
+ * `process_clock`, capturing real, user-CPU, and system-CPU times.
+ * `process_timer`, capturing elapsed real, user-CPU, and system-CPU times.
+ * `run_timer`, convenient reporting of process_timer results.
+
+[/====================================]
+[heading How to Use This Documentation]
+[/====================================]
+
+This documentation makes use of the following naming and formatting conventions.
+
+* Code is in `fixed width font` and is syntax-highlighted.
+* Replaceable text that you will need to supply is in [~italics].
+* If a name refers to a free function, it is specified like this:
+ `free_function()`; that is, it is in code font and its name is followed by `()` to indicate that it is a free function.
+* If a name refers to a class template, it is specified like this: `class_template<>`; that is, it is in code font and its name is followed by `<>` to indicate that it is a class template.
+* If a name refers to a function-like macro, it is specified like this: `MACRO()`;
+ that is, it is uppercase in code font and its name is followed by `()` to indicate that it is a function-like macro. Object-like macros appear without the trailing `()`.
+* Names that refer to /concepts/ in the generic programming sense are specified in CamelCase.
+
+[note In addition, notes such as this one specify non-essential information that provides additional background or rationale.]
+
+Finally, you can mentally add the following to any code fragments in this document:
+
+ // Include all of Chono files
+ #include <boost/chono.hpp>
+ #include <boost/ratio.hpp>
+ #include <boost/type_traits/common_type.hpp>
+ #include <boost/chono/timer.hpp>
+ #include <boost/chono/process_times.hpp>
+
+[/=================]
+[section Motivation]
+[/=================]
+
+See [@http://www.open-std.org/jtc1/sc22/wg21 [*N2661 - A Foundation to Sleep On]] which is very informative and provides motivation for key design decisions for `common_type`, `ratio` and `chrono`. The following sections are an extract from this document.
+
+[section Common type]
+
+`common_type` has been a recurring theme in many places for many years. We've previously known it as promote and examples of it are spread throughout boost. It has been reinvented independently several times, because it is so useful.
+
+Andrei Alexandrescu recently pointed us at a D library: std.traits - D Programming Language - Digital Mars, which became the motivation for this particular name, and the variadic nature of this trait.
+
+In a nutshell, `common_type` is a trait that takes 1 or more types, and returns a type which all of the types will convert to. The default definition demands this conversion be implicit. However the trait can be specialized for user-defined types which want to limit their inter-type conversions to explicit, and yet still want to interoperate with the `common_type` facility.
+
+[*Example:]
+
+ template <class T, class U>
+ typename common_type<complex<T>, complex<U> >::type
+ operator+(complex<T>, complex<U>);
+
+In the above example, "mixed-mode" complex arithmetic is allowed. The return type is described by `common_type`. For example the resulting type of adding a `complex<int>` and `complex<double>` might be a `complex<double>`. Another choice for the author might be:
+
+ template <class T, class U>
+ complex<typename common_type<T, U>::type>
+ operator+(complex<T>, complex<U>);
+
+Here is how someone might produce a variadic comparison function:
+
+ template <class ...T>
+ typename common_type<T...>::type
+ min(T... t);
+
+This is a very useful and broadly applicable utility. The `duration` and `time_point` facilities use it to make multi-precision arithmetic seamless and exact.
+
+
+[endsect]
+
+[section Ratio]
+
+`ratio` is a general purpose utility inspired by Walter Brown allowing one to easily and safely compute rational values at compile time. The `ratio` class catches all errors (such as divide by zero and overflow) at compile time. It is used in the `duration` and `time_point` classes to efficiently create units of time. It can also be used in other "quantity" libraries (both std-defined and user-defined), or anywhere there is a rational constant which is known at compile time. The use of this utility can greatly reduce the chances of run time overflow because the `ratio` (and any ratios resulting from `ratio` arithmetic) are always reduced to lowest terms.
+
+`ratio` is a template taking two intmax_ts, with the second defaulted to 1. It only has two public members, both of which are static const intmax_t. One is the numerator of the `ratio` and the other is the denominator. The `ratio` is always normalized such that it is expressed in lowest terms, and the denominator is always positive. When the numerator is 0, the denominator is always 1.
+
+[*Example:]
+
+ typedef ratio<5, 3> five_thirds; // five_thirds::num == 5, five_thirds::den == 3
+ typedef ratio<25, 15> also_five_thirds; // also_five_thirds::num == 5, also_five_thirds::den == 3
+ typedef ratio_divide<five_thirds, also_five_thirds>::type one; // one::num == 1, one::den == 1
+
+This facility also includes convenience typedefs for the SI prefixes atto through exa corresponding to their internationally recognized definitions (in terms of `ratio`). This is a tremendous syntactic convenience. It will prevent errors in specifying constants as one no longer has to double count the number of zeros when trying to write million or billion.
+
+[*Example:]
+
+ typedef ratio_multiply<ratio<5>, giga>::type _5giga; // _5giga::num == 5000000000, _5giga::den == 1
+ typedef ratio_multiply<ratio<5>, nano>::type _5nano; // _5nano::num == 1, _5nano::den == 200000000
+
+[endsect]
+
+
+[section Duration]
+
+The `duration` is the heart of this library. The interface that the user will see in everyday use is nearly identical to that of Boost.DateTime time `duration`s authored by Jeff Garland, both in syntax and in behavior. This has been a very popular boost library for 7 years. There is an enormous positive history with this interface.
+
+The library consists of six units of time `duration`:
+
+* hours
+* minutes
+* seconds
+* milliseconds
+* microseconds
+* nanoseconds
+
+These units were chosen as a subset of the boost library because they are the most common units used when sleeping, waiting on a condition variable, or waiting to obtain the lock on a mutex. Each of these units is nothing but a thin wrapper around a signed integral count. That is, when you construct `minutes(3)`, all that happens is a 3 is stored inside of minutes. When you construct `microseconds(3)`, all that happens is a 3 is stored inside of microseconds.
+
+The only context in which these different types differ is when being converted to one another. At this time, unit-specific compile-time conversion constants are used to convert the source unit to the target unit. Only conversions from coarser units to finer units are allowed (in boost). This restriction ensures that all conversions are always exact. That is, microseconds can always represent any value minutes has.
+
+In Boost.DateTime, these units are united via inheritance. Boost.Chrono instead unites these units through the class template `duration`. That is, in Boost.Chrono all six of the above units are nothing but typedefs to different instantiations of `duration`. This change from Boost.DateTime has a far reaching positive impact, while not changing the syntax of the everyday use at all.
+
+The most immediate positive impact is that the library can immediately generate any unit, any precision it needs. This is sometimes necessary when doing comparisons or arithmetic between `duration`s of differing precision, assuming one wants the comparison and arithmetic to be exactly correct.
+
+A secondary benefit is that by publishing the class template `duration` interface, user code can very easily create `duration`s with any precision they desire. The `ratio` utility is used to specify the precision, so as long as the precision can be expressed by a rational constant with respect to seconds, this framework can exactly represent it (one third of a second is no problem, and neither is one third of a femto second). All of this utility and flexibility comes at no cost just by making use of the no-run-time-overhead `ratio` facility.
+
+In Boost.DateTime, hours does not have the same representation as nanoseconds. The former is usually represented with a long whereas a long long is required for the latter. The reason for this is simply range. You don't need many hours to cover an extremely large range of time. But this isn't true of nanoseconds. Being able to reduce the sizeof overhead for some units when possible, can be a significant performance advantage.
+
+Boost.Chrono continues, and generalizes that philosophy. Not only can one specify the precision of a `duration`, one can also specify its representation. This can be any integral type, or even a floating point type. Or it can be a user-defined type which emulates an arithmetic type. The six predefined units all use signed integral types as their representation. And they all have a minimum range of +/- 292 years. nanoseconds needs 64 bits to cover that range. hours needs only 23 bits to cover that range.
+
+[heading So What Exactly is a `duration` and How Do I Use One?]
+
+A `duration` has a representation and a tick period (precision).
+
+ template <class Rep, class Period = ratio<1> > class duration;
+
+The representation is simply any arithmetic type, or an emulation of such a type. The representation stores a count of ticks. This count is the only data member stored in a `duration`. If the representation is floating point, it can store fractions of a tick to the precision of the representation. The tick period is represented by a `ratio` and is encoded into the `duration`'s type, instead of stored. The tick period only has an impact on the behavior of the `duration` when a conversion between different `duration`'s is attempted. The tick period is completely ignored when simply doing arithmetic among like `duration`s.
+
+[*Example:]
+
+ typedef duration<long, ratio<60> > minutes;
+ minutes m1(3); // m1 stores 3
+ minutes m2(2); // m2 stores 2
+ minutes m3 = m1 + m2; // m3 stores 5
+
+ typedef duration<long long, micro> microseconds;
+ microseconds us1(3); // us1 stores 3
+ microseconds us2(2); // us2 stores 2
+ microseconds us3 = us1 + us2; // us3 stores 5
+
+ microseconds us4 = m3 + us3; // us4 stores 300000005
+
+In the final line of code above, there is an implicit conversion from minutes to microseconds, resulting in a relatively large number of microseconds.
+
+If you need to access the tick count within a `duration`, there is a member `count()` which simply returns the stored tick count.
+
+ long long tc = us4.count(); // tc is 300000005
+
+These `duration`s have very simple, very predictable, and very observable behavior. After all, this is really nothing but the time tested interface of Jeff's boost time `duration` library (unified with templates instead of inheritance).
+
+[heading What happens if I assign `m3 + us3` to minutes instead of microseconds?]
+
+ minutes m4 = m3 + us3;
+
+It won't compile. The rationale is that implicit truncation error should not be allowed to happen. If this were to compile, then `m4` would hold `5`, the same value as `m3`. The value associated with `us3` has been effectively ignored. This is similar to the problem of assigning a double to an `int`: the fractional part gets silently discarded.
+
+[heading But what if the truncation behavior is what I want to do?]
+
+There is a `duration_cast` facility to explicitly ask for this behavior:
+
+ minutes m4 = duration_cast<minutes>(m3 + us3); // m4.count() == 5
+
+In general, one can perform `duration` arithmetic at will. If `duration_cast` isn't used, and it compiles, the arithmetic is exact. Any place one wants to override this exact arithmetic behavior, duration_cast can be used to explicitly specify that desire. The `duration_cast` has the same efficiency as the implicit conversion, and will even be exact as often as it can.
+
+[heading I'm trafficking in floating point `duration`s. I don't want to deal with writing `duration_cast` all over the place. I'm content with the precision of my floating point representation]
+
+Not a problem. When the destination of a conversion has floating point representation, all conversions are allowed to happen implicitly.
+
+ typedef duration<double, ratio<60> > dminutes;
+ dminutes dm4 = m3 + us3; // dm4.count() == 5.000000083333333
+
+[heading How expensive is all of this?]
+
+If you were writing these conversions by hand, you could not make it more efficient. The use of `ratio` ensures that all conversion constants are simplified as much as possible at compile time. This usually results in the numerator or denominator of the conversion factor simplifying to `1`, and being subsequently ignored in converting the run time values of the tick counts.
+
+[heading How complicated is it to build a function taking a `duration` parameter?]
+
+There are several options open to the user:
+
+* If the author of the function wants to accept any `duration`, and is willing to work in floating point `duration`s, he can simply use any floating point `duration` as the parameter:
+
+ void f(duration<double> d) // accept floating point seconds
+ {
+ // d.count() == 3.e-6 when passed microseconds(3)
+ }
+
+ f(microseconds(3));
+
+* If the author of the function wants to traffic only in integral `duration`s, and is content with handling nothing finer than say nanoseconds (just as an example), he can simply specify nanoseconds as the parameter:
+
+ void f(nanoseconds d)
+ {
+ // d.count() == 3000 when passed microseconds(3)
+ }
+
+ f(microseconds(3));
+
+In this design, if the client wants to pass in a floating point `duration`, or a `duration` of finer precision than nanoseconds, then the client is responsible for choosing his own rounding mode in the conversion to nanoseconds.
+
+ duration<double> s(1./3); // 1/3 of a second
+ f(duration_cast<nanoseconds>(s)); // round towards zero in conversion to nanoseconds
+
+In the example above, the client of f has chosen "round towards zero" as the desired rounding mode to nanoseconds. If the client has a `duration` that won't exactly convert to nanoseconds, and fails to choose how the conversion will take place, the compiler will refuse the call:
+
+ f(s); // does not compile
+
+* If the author of the function wants to accept any `duration`, but wants to work with integral representations and wants to control the rounding mode internally, then he can template the function:
+
+ template <class Rep, class Period>
+ void f(duration<Rep, Period> d)
+ {
+ // convert d to nanoseconds, rounding up if it is not an exact conversion
+ nanoseconds ns = duration_cast<nanoseconds>(d);
+ if (ns < d)
+ ++ns;
+ // ns.count() == 333333334 when passed 1/3 of a floating point second
+ }
+
+ f(duration<double>(1./3));
+
+* If the author in the example does not want to accept floating point based `duration`s, he can enforce that behavior like so:
+
+ template <class Period>
+ void f(duration<long long, Period> d)
+ {
+ // convert d to nanoseconds, rounding up if it is not an exact conversion
+ nanoseconds ns = duration_cast<nanoseconds>(d);
+ if (ns < d)
+ ++ns;
+ // ns.count() == 333333334 when passed 333333333333 picoseconds
+ }
+
+ f(duration<long long, pico>(333333333333)); // About 1/3 of a second worth of picoseconds
+
+Clients with floating point `duration`s who want to use f will now have to convert to an integral `duration` themselves before passing the result to f.
+
+In summary, the author of f has quite a bit of flexibility and control in the interface he wants to provide his clients with, and easy options for manipulating that `duration` internal to his function.
+
+[endsect]
+
+[section Clocks]
+
+While `duration`s only have precision and representation to concern themselves, clocks and `time_point`s are intimately related and refer to one another. Because clocks are simpler to explain, we will do so first without fully explaining `time_point`s. Once clocks are introduced, it will be easier to then fill in what a `time_point` is.
+
+A clock is a concept which bundles 3 things:
+
+# A concrete `duration` type.
+# A concrete `time_point` type.
+# A function called now() which returns the concrete `time_point`.
+
+Boost.Chrono proposes 3 concrete clocks:
+
+# system_clock
+# monotonic_clock
+# high_precision_clock
+
+A given platform may not be able to supply all three of these clocks. The user is also able to easily create more clocks.
+
+Given a clock named Clock, it will have:
+
+ class Clock {
+ public:
+ typedef an arithmetic-like type rep;
+ typedef an instantiation of ratio period;
+ typedef std::chrono::duration<rep, period> duration;
+ typedef std::chrono::time_point<Clock> time_point;
+ static const bool is_monotonic = true or false;
+
+ static time_point now();
+ };
+
+One can get the current time from Clock with:
+
+ Clock::time_point t1 = Clock::now();
+
+And one can get the time `duration` between two `time_point`s associated with Clock with:
+
+ Clock::duration d = t1 - Clock::now();
+
+And one can specify a past or future `time_point` with:
+
+ Clock::time_point t2 = Clock::now() + d;
+
+Note how even if a particular clock becomes obsolete, the next clock in line will have the same API. There is no new learning curve to come up. The only source code changes will be simply changing the type of the clock. The same `duration` and `time_point` framework continues to work as new clocks are introduced. And multiple clocks are safely and easily handled within the same program.
+
+[endsect]
+
+[section Time Point]
+
+A `time_point` represents a point in time, as opposed to a `duration` of time. Another way of saying the same thing, is that a `time_point` represents an epoch plus or minus a `duration`. Examples of `time_point`s include:
+
+* 3 minutes after the computer booted.
+* 03:14:07 UTC on Tuesday, January 19, 2038
+* 20 milliseconds after I started that timer.
+
+In each of the examples above, a different epoch is implied. Sometimes an epoch has meaning for several millennia. Other times the meaning of an epoch is lost after a while (such as the start of a timer, or when the computer booted). However, if two `time_point`s are known to share the same epoch, they can be subtracted, yielding a valid `duration`, even if the definition of the epoch no longer has meaning.
+
+In Boost.Chrono, an epoch is a purely abstract and unspecified concept. There is no type representing an epoch. It is simply an idea that relates (or doesn't) `time_point`s to a clock, and in the case that they share a clock, `time_point`s to one another. `time_point`s associated with different clocks are generally not interoperable unless the relationship between the epochs associated with each clock is known.
+
+[heading So What Exactly is a `time_point` and How Do I Use One?]
+
+A `time_point` has a clock and a `duration`.
+
+ template <class Clock, class Duration = typename Clock::duration> class time_point;
+
+The `time_point`'s clock is not stored. It is simply embedded into the `time_point`'s type and serves two purposes:
+
+# Because `time_point`s originating from different clocks have different types, the compiler can be instructed to fail if incompatible `time_point`s are used in inappropriate ways.
+# Given a `time_point`, one often needs to compare that `time_point` to "now". This is very simple as long as the `time_point` knows what clock it is defined with respect to.
+
+A `time_point`'s `duration` is stored as the only data member of the `time_point`. Thus `time_point`s and their corresponding `duration` have exactly the same layout. But they have very different meanings. For example, it is one thing to say I want to sleep for 3 minutes. It is a completely different thing to say I want to sleep until 3 minutes past the time I started that timer (unless you just happened to start that timer now). Both meanings (and options for sleeping) have great practical value in common use cases for sleeping, waiting on a condition variable, and waiting for a mutex's lock. These same concepts and tools are found (for example) in Ada.
+
+A timer example:
+
+ void f()
+ {
+ monotonic_clock::time_point start = monotonic_clock::now();
+ g();
+ h();
+ duration<double> sec = monotonic_clock::now() - start;
+ cout << "f() took " << sec.count() << " seconds\n";
+ }
+
+Note that if one is using the `duration` between two clock `time_point`s in a way where the precision of the `duration` matters, it is good practice to convert the clock's native `duration` to a known `duration`. This insulates the code from future changes which may be made to the clock's native precision in the future. For example monotonic_clock could easily be based on the clock speed of the cpu. When you upgrade to a faster machine, you do not want your code that assumed a certain tick period of this clock to start experiencing run time failures because your timing code has silently changed meaning.
+
+A delay loop example:
+
+ // delay for at least 500 nanoseconds:
+ auto go = monotonic_clock::now() + nanoseconds(500);
+ while (monotonic_clock::now() < go)
+ ;
+
+The above code will delay as close as possible to half a microsecond, no matter what the precision of monotonic_clock is. The more precise `monotonic_clock` becomes, the more accurate will be the delay to 500 nanoseconds.
+
+[endsect]
+
+
+[section Timers]
+
+Knowing how long a program takes to execute is useful in both test and production environments. It is also helpful if such timing information is broken down into real (wall clock) time, CPU time spent by the user, and CPU time spent by the operating system servicing user requests.
+
+The Boost Chrono Library's process times components provide that information:
+
+* At the highest level, class `run_timer` provides a complete run time reporting package that can be invoked in a single line of code.
+* At a middle level, class `process_timer` provides a process timer useful when the automatic reporting of `run_timer` isn't desired.
+* At the lowest level, `process_clock` provides a thin wrapper around the operating system's process timer API. For POSIX-like systems, that's the times() function, while for Windows, it's the GetProcessTimes() function.
+
+[endsect]
+
+
+[endsect]
+[endsect]
+
+
+[/==============================]
+[section:users_guide Users'Guide]
+[/==============================]
+
+[/======================================]
+[section:getting_started Getting Started]
+[/======================================]
+
+[/======================================]
+[section:install Installing Chrono]
+[/======================================]
+
+[/=================================]
+[heading Getting Boost.Chrono]
+[/=================================]
+
+You can get the last stable release of Boost.Chrono by downloading [^chrono.zip] from the
+[@http://www.boost-consulting.com/vault/index.php?directory=System Boost Vault]
+
+You can also access the latest (unstable?) state from the [@https://svn.boost.org/svn/boost/sandbox/chrono Boost Sandbox].
+
+[/=================================]
+[heading Building Boost.Chrono]
+[/=================================]
+
+__Boost_Chono__ is not a header only library. You need to compile it before use.
+
+ bjam libs/chrono/build
+
+
+[/=========================]
+[heading Requirements]
+[/=========================]
+
+[*Boost.Bitfield] depends on some Boost libraries. For these specific parts you must use either Boost version 1.39.0 or the version in SVN trunk (even if older version should works also).
+
+In particular, Boost.Chrono depends on:
+
+[variablelist
+[
+ [[@http://www.boost.org/libs/config [*Boost.Config]]] [for configuration purposes, ...]
+]
+[
+ [[@http://www.boost.org/libs/exception [*Boost.Exception]]] [for throw_exception, ...]
+]
+[
+ [[@http://www.boost.org/libs/system [*Boost.System]]] [for error_code, ...]
+]
+[
+ [[@http://www.boost.org/libs/type_traits [*Boost.TypeTraits]]] [for ..., ...]
+]
+[
+ [[@http://www.boost.org/libs/typeof [*Boost.Typeof]]] [for typeof, ...]
+]
+[
+ [[@http://www.boost.org/libs/utility [*Boost.UtiliTy/EnableIf]]] [for enable_if, ...]
+]
+]
+
+[/========================]
+[heading Exceptions safety]
+[/========================]
+
+All functions in the library are exception-neutral and provide strong guarantee of exception safety as long as the underlying parameters provide it.
+
+[/====================]
+[heading Thread safety]
+[/====================]
+
+All functions in the library are thread-unsafe except when noted explicitly.
+
+[/=======================]
+[heading Tested compilers]
+[/=======================]
+
+The implementation will eventually work with most C++03 conforming compilers. Initial tests have been run on
+
+Windows with
+
+* VC++ 9.0 SP1
+* Intel 11.0
+
+On Ubuntu Linux with
+
+* GCC 4.2.4
+
+On SL Linux with
+
+* GCC 3.4.6
+* GCC 4.1.2
+
+On Cygwin with
+
+* GCC 3.4.4
+[/* GCC 4.3.2]
+
+
+[note Please send any questions, comments and bug reports to boost <at> lists <dot> boost <dot> org.]
+
+[endsect]
+[/=============================]
+[section Hello World! ]
+[/=============================]
+
+If all you want to do is to time a program's execution:
+
+ #include <boost/chrono/process_times.hpp>
+
+ ...
+
+ // add this in the scope you want to time,
+ // at the point you want the timer to start.
+ boost::chrono::run_timer rt;
+
+Here is a complete program (run_timer_example.cpp):
+
+ #include <boost/chrono/process_times.hpp>
+ #include <cmath>
+
+ int main()
+ {
+ boost::chrono::run_timer t;
+
+ for ( long i = 0; i < 10000000; ++i )
+ std::sqrt( 123.456L ); // burn some time
+
+ return 0;
+ }
+
+Debug build output was:
+
+ real 0.832s, cpu 0.813s (97.7%), user 0.813s, system 0.000s
+
+In other words, the program took 0.832 real-time (i.e. wall clock) seconds to execute, while the operating system (Windows in this case) charged 0.813 seconds of CPU time to the user and 0 seconds to the system. The total CPU time reported was 0.813 seconds, and that represented utilization of 97.7% of the real-time seconds.
+
+[endsect]
+
+[endsect]
+
+[section Tutorial]
+
+[endsect]
+
+[section:ext_references References]
+
+[variablelist
+
+[
+ [[@http://www.open-std.org/jtc1/sc22/wg21 [*C++ Standards Committee's current Working Paper]]]
+ [The most authoritative reference material for the library is the C++ Standards Committee's current Working Paper (WP). 20.9 Time utilities "time", 20.4 Compile-time rational arithmetic "ratio", 20.6.7 Other transformations "meta.trans.other"]
+]
+
+[
+ [[@http://www.open-std.org/jtc1/sc22/wg21 [*N2661 - A Foundation to Sleep On]]]
+ [From Howard E. Hinnant, Walter E. Brown, Jeff Garland and Marc Paterno. Is very informative and provides motivation for key design decisions]
+]
+
+]
+
+[endsect]
+
+[endsect]
+
+[section Reference]
+
+
+[/==========================================================================================]
+[section:common_type_hpp Header `<boost/type_traits/common_type.hpp>`]
+[/==========================================================================================]
+
+ namespace boost {
+ template <class ...T> struct common_type;
+ }
+
+[section:common_type Class Template `common_type`]
+
+`common_type` is a facility which is useful in specifying the type of the result of functions and operators which take a variety of types (e.g. "mixed mode" complex arithmetic).
+
+The nested typedef `common_type::type` shall be defined as follows:
+
+ template <class T, class U = void, class V = void>
+ struct common_type {
+ typedef typename common_type<typename common_type<T, U>::type, V>::type type;
+ };
+
+ template <class T>
+ struct common_type<T, void, void> {
+ typedef T type;
+ };
+
+ template <class T, class U>
+ struct common_type<T, U, void> {
+ private:
+ static T m_t();
+ static U m_u();
+ static bool m_f(); // workaround gcc bug; not required by std
+ public:
+ typedef BOOST_TYPEOF_TPL(m_f() ? m_t() : m_u()) type;
+ };
+
+All types in the parameter pack T shall be complete. This trait is permitted to be specialized by a user if at least one template parameter is a user-defined type.
+
+[*Note:] Such specializations are required when only explicit conversions are desired among the `common_type` arguments.
+
+
+[endsect]
+
+[endsect]
+
+
+[/==========================================================================================]
+[section:ratio_hpp Header `<boost/ratio.hpp>`]
+[/==========================================================================================]
+
+`ratio` is a facility which is useful in specifying compile time rational constants. Compile time rational arithmetic is supported with protection against overflow and divide by zero. Such a facility is very handy when needing to efficiently represent 1/3 of a nanosecond, or specifying an inch in terms of meters (for example 254/10000 meters - which `ratio` will reduce to 127/5000 meters).
+
+ namespace boost {
+
+ template <boost::intmax_t N, boost::intmax_t D = 1> class ratio;
+
+ // ratio arithmetic
+ template <class R1, class R2> struct ratio_add;
+ template <class R1, class R2> struct ratio_subtract;
+ template <class R1, class R2> struct ratio_multiply;
+ template <class R1, class R2> struct ratio_divide;
+
+ // ratio comparison
+ template <class R1, class R2> struct ratio_equal;
+ template <class R1, class R2> struct ratio_not_equal;
+ template <class R1, class R2> struct ratio_less;
+ template <class R1, class R2> struct ratio_less_equal;
+ template <class R1, class R2> struct ratio_greater;
+ template <class R1, class R2> struct ratio_greater_equal;
+
+ // convenience SI typedefs
+ typedef ratio<1LL, 1000000000000000000LL> atto;
+ typedef ratio<1LL, 1000000000000000LL> femto;
+ typedef ratio<1LL, 1000000000000LL> pico;
+ typedef ratio<1LL, 1000000000LL> nano;
+ typedef ratio<1LL, 1000000LL> micro;
+ typedef ratio<1LL, 1000LL> milli;
+ typedef ratio<1LL, 100LL> centi;
+ typedef ratio<1LL, 10LL> deci;
+ typedef ratio< 10LL, 1LL> deca;
+ typedef ratio< 100LL, 1LL> hecto;
+ typedef ratio< 1000LL, 1LL> kilo;
+ typedef ratio< 1000000LL, 1LL> mega;
+ typedef ratio< 1000000000LL, 1LL> giga;
+ typedef ratio< 1000000000000LL, 1LL> tera;
+ typedef ratio< 1000000000000000LL, 1LL> peta;
+ typedef ratio<1000000000000000000LL, 1LL> exa;
+ }
+
+
+[section:ratio Class Template `ratio<>`]
+
+ template <boost::intmax_t N, boost::intmax_t D>
+ class ratio {
+ public:
+ static const boost::intmax_t num;
+ static const boost::intmax_t den;
+ typedef ratio<num, den> type;
+
+ ratio() {}
+
+ template <intmax_t _N2, intmax_t _D2>
+ ratio(const ratio<_N2, _D2>&,
+ typename enable_if_c
+ <
+ ratio<_N2, _D2>::num == num &&
+ ratio<_N2, _D2>::den == den
+ >::type* = 0) {}
+
+ template <intmax_t _N2, intmax_t _D2>
+ typename enable_if_c
+ <
+ ratio<_N2, _D2>::num == num &&
+ ratio<_N2, _D2>::den == den,
+ ratio&
+ >::type
+ operator=(const ratio<_N2, _D2>&) {return *this;}
+ };
+
+A diagnostic shall be emitted if `ratio` is instantiated with `D == 0`, or if the absolute value of `N` or `D` can not be represented. [*Note:] These rules ensure that infinite ratios are avoided and that for any negative input, there exists a representable value of its absolute value which is positive. In a two's complement representation, this excludes the most negative value.
+
+Let `gcd` denote the greatest common divisor of `N`'s absolute value and of `D`'s absolute value.
+
+* `num` shall have the value `sign(N)*sign(D)*abs(N)/gcd`.
+
+* `den` shall have the value `abs(D)/gcd`.
+
+The nested typedef `type` denotes the normalized form of this ratio type. It should be used when the template parameters don't give a normalized form.
+
+Two `ratio` classes `ratio<N1,D1>` and `ratio<N2,D2>` have the same normalized form if `ratio<N1,D1>::type` is the same type as `ratio<N2,D2>::type`
+
+[section Construction and assignment]
+
+ template <intmax_t N2, intmax_t D2>
+ ratio(const ratio<N2, D2>& r);
+
+[*Effects:] Constructs a `ratio` object.
+
+[*Remarks:] This constructor shall not participate in overload resolution unless `r` has the same normalized form as `*this`.
+
+ template <intmax_t N2, intmax_t D2>
+ ratio& operator=(const ratio<N2, D2>& r);
+
+[*Effects:] Assigns a `ratio` object.
+
+[*Returns:] *this.
+
+[*Remarks:] This operator shall not participate in overload resolution unless `r` has the same normalized form as `*this`.
+
+[endsect]
+
+
+[endsect]
+
+
+[section:ratio_arithmetic `ratio` arithmetic]
+
+For each of the class templates in this clause, each template parameter shall refer to a `ratio`. If the implementation is unable to form the indicated `ratio` due to overflow, a diagnostic shall be issued.
+
+ template <class R1, class R2> struct ratio_add {
+ typedef [/see below] type;
+ };
+
+The nested typedef `type` shall be a synonym for `ratio<R1::num * R2::den + R2::num * R1::den, R1::den * R2::den>::type`.
+
+ template <class R1, class R2> struct ratio_subtract {
+ typedef [/see below] type;
+ };
+
+The nested typedef `type` shall be a synonym for `ratio<R1::num * R2::den - R2::num * R1::den, R1::den * R2::den>::type`.
+
+ template <class R1, class R2> struct ratio_multiply {
+ typedef [/see below] type;
+ };
+
+The nested typedef `type` shall be a synonym for `ratio<R1::num * R2::num, R1::den * R2::den>::type`.
+
+ template <class R1, class R2> struct ratio_divide {
+ typedef [/see below] type;
+ };
+
+The nested typedef `type` shall be a synonym for `ratio<R1::num * R2::den, R2::num * R1::den>::type`.
+
+[endsect]
+
+[section:ratio_comparison `ratio` comparison]
+
+ template <class R1, class R2> struct ratio_equal
+ : public boost::integral_constant<bool, [/see below] > {};
+
+If R1::num == R2::num && R1::den == R2::den, ratio_equal derives from true_type, else derives from false_type.
+
+ template <class R1, class R2>
+ struct ratio_less
+ : public boost::integral_constant<bool, [/see below] > {};
+
+If R1::num * R2::den < R2::num * R1::den, ratio_less derives from true_type, else derives from false_type. Implementations are permitted to use more complex algorithms to compute the above relationship to avoid overflow. If the implementation is not able to avoid overflow, a diagnostic shall be emitted.
+
+
+ template <class R1, class R2> struct ratio_not_equal
+ : public boost::integral_constant<bool, !ratio_equal<R1, R2>::value> {};
+
+ template <class R1, class R2> struct ratio_less_equal
+ : public boost::integral_constant<bool, !ratio_less<R2, R1>::value> {};
+
+ template <class R1, class R2> struct ratio_greater
+ : public boost::integral_constant<bool, ratio_less<R2, R1>::value> {};
+
+ template <class R1, class R2> struct ratio_greater_equal
+ : public boost::integral_constant<bool, !ratio_less<R1, R2>::value> {};
+
+
+[endsect]
+
+[section:ration_SI_typedefs SI typedefs]
+
+ // convenience SI typedefs
+ typedef ratio<1LL, 1000000000000000000LL> atto;
+ typedef ratio<1LL, 1000000000000000LL> femto;
+ typedef ratio<1LL, 1000000000000LL> pico;
+ typedef ratio<1LL, 1000000000LL> nano;
+ typedef ratio<1LL, 1000000LL> micro;
+ typedef ratio<1LL, 1000LL> milli;
+ typedef ratio<1LL, 100LL> centi;
+ typedef ratio<1LL, 10LL> deci;
+ typedef ratio< 10LL, 1LL> deca;
+ typedef ratio< 100LL, 1LL> hecto;
+ typedef ratio< 1000LL, 1LL> kilo;
+ typedef ratio< 1000000LL, 1LL> mega;
+ typedef ratio< 1000000000LL, 1LL> giga;
+ typedef ratio< 1000000000000LL, 1LL> tera;
+ typedef ratio< 1000000000000000LL, 1LL> peta;
+ typedef ratio<1000000000000000000LL, 1LL> exa;
+
+
+Four of the typedefs in the recomendation which can be conditionally supported are not supported: yocto, zepto, zetta and yotta.
+
+ typedef ratio<1, 1000000000000000000000000> yocto; // conditionally supported
+ typedef ratio<1, 1000000000000000000000> zepto; // conditionally supported
+ typedef ratio< 1000000000000000000000, 1> zetta; // conditionally supported
+ typedef ratio<1000000000000000000000000, 1> yotta; // conditionally supported
+
+[endsect]
+
+[endsect]
+
+
+[/==========================================================================================]
+[section:chrono_hpp Header `<boost/chrono.hpp>`]
+[/==========================================================================================]
+
+ namespace boost {
+ namespace chrono {
+
+ template <class Rep, class Period = ratio<1> > class duration;
+ template <class Clock, class Duration = typename Clock::duration> class time_point;
+
+ }
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ struct common_type<chrono::duration<Rep1, Period1>,
+ chrono::duration<Rep2, Period2> >;
+
+ template <class Clock, class Duration1, class Duration2>
+ struct common_type<chrono::time_point<Clock, Duration1>,
+ chrono::time_point<Clock, Duration2> >;
+
+ namespace chrono {
+
+ // customization traits
+ template <class Rep> struct treat_as_floating_point;
+ template <class Rep> struct duration_values;
+
+ // duration arithmetic
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2> >::type
+ operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2> >::type
+ operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+ template <class Rep1, class Period, class Rep2>
+ duration<typename common_type<Rep1, Rep2>::type, Period>
+ operator*(const duration<Rep1, Period>& d, const Rep2& s);
+
+ template <class Rep1, class Period, class Rep2>
+ duration<typename common_type<Rep1, Rep2>::type, Period>
+ operator*(const Rep1& s, const duration<Rep2, Period>& d);
+
+ template <class Rep1, class Period, class Rep2>
+ duration<typename common_type<Rep1, Rep2>::type, Period>
+ operator/(const duration<Rep1, Period>& d, const Rep2& s);
+
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ typename common_type<Rep1, Rep2>::type
+ operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+ // duration comparisons
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+ // duration_cast
+
+ template <class ToDuration, class Rep, class Period>
+ ToDuration duration_cast(const duration<Rep, Period>& d);
+
+ // convenience typedefs
+ typedef duration<boost::int_least64_t, nano> nanoseconds; // at least 64 bits needed
+ typedef duration<boost::int_least64_t, micro> microseconds; // at least 55 bits needed
+ typedef duration<boost::int_least64_t, milli> milliseconds; // at least 45 bits needed
+ typedef duration<boost::int_least64_t> seconds; // at least 35 bits needed
+ typedef duration<boost::int_least32_t, ratio< 60> > minutes; // at least 29 bits needed
+ typedef duration<boost::int_least32_t, ratio<3600> > hours; // at least 23 bits needed
+
+ // time_point arithmetic
+ template <class Clock, class Duration1, class Rep2, class Period2>
+ time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2> >::type>
+ operator+(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
+
+ template <class Rep1, class Period1, class Clock, class Duration2>
+ time_point<Clock, typename common_type<duration<Rep1, Period1>, Duration2>::type>
+ operator+(const duration<Rep1, Period1>& lhs, const time_point<Clock, Duration2>& rhs);
+
+ template <class Clock, class Duration1, class Rep2, class Period2>
+ time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2> >::type>
+ operator-(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
+
+ template <class Clock, class Duration1, class Duration2>
+ typename common_type<Duration1, Duration2>::type
+ operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock,
+ Duration2>& rhs);
+
+ // time_point comparisons
+ template <class Clock, class Duration1, class Duration2>
+ bool operator==(const time_point<Clock, Duration1>& lhs, const time_point<Clock,
+ Duration2>& rhs);
+ template <class Clock, class Duration1, class Duration2>
+ bool operator!=(const time_point<Clock, Duration1>& lhs, const time_point<Clock,
+ Duration2>& rhs);
+ template <class Clock, class Duration1, class Duration2>
+ bool operator< (const time_point<Clock, Duration1>& lhs, const time_point<Clock,
+ Duration2>& rhs);
+ template <class Clock, class Duration1, class Duration2>
+ bool operator<=(const time_point<Clock, Duration1>& lhs, const time_point<Clock,
+ Duration2>& rhs);
+ template <class Clock, class Duration1, class Duration2>
+ bool operator> (const time_point<Clock, Duration1>& lhs, const time_point<Clock,
+ Duration2>& rhs);
+ template <class Clock, class Duration1, class Duration2>
+ bool operator>=(const time_point<Clock, Duration1>& lhs, const time_point<Clock,
+ Duration2>& rhs);
+
+ // time_point_cast
+ template <class ToDuration, class Clock, class Duration>
+ time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t);
+
+ // Clocks
+ class system_clock;
+ class monotonic_clock;
+ class high_resolution_clock;
+
+ }
+ }
+
+[section `Clock` Requirements]
+
+A clock represents a bundle consisting of a native `duration`, a native `time_point`, and a function `now()` to get the current `time_point`. A clock shall meet the requirements in the following Table.
+
+In this table `C1` and `C2` denote `clock` types. `t1` and `t2` are values returned from `C1::now()` where the call returning `t1` happens before the call returning `t2` and both of these calls happen before `C1::time_point::max()`.
+
+[table Clock Requirements
+ [[expression] [return type] [operational semantics]]
+ [[`C1::rep`] [An arithmetic type or class emulating an arithmetic type. ] [The representation type of the native `duration` and `time_point`.]]
+ [[`C1::period`] [`ratio`] [The tick period of the clock in seconds.]]
+ [[`C1::duration`] [`chrono::duration<C1::rep, C1::period>`] [The native `duration` type of the `clock`.]]
+ [[`C1::time_point`] [`chrono::time_point<C1> or chrono::time_point<C2, C1::duration>`] [The native `time_point` type of the `clock`. Different clocks are permitted to share a `time_point` definition if it is valid to compare their time_points by comparing their respective `duration`s. `C1` and `C2` shall refer to the same epoch.]]
+ [[`C1::is_monotonic`] [`const bool`] [`true` if `t1 <= t2` is always `true`, else `false`. [*Note: A `clock` that can be adjusted backwards is not monotonic]]]
+ [[`C1::now()`] [`C1::time_point`] [Returns a `time_point` representing the current point in time.]]
+]
+
+[endsect]
+
+[section Time-related traits]
+[section:treat_as_floating_point Metafunction `treat_as_floating_point<>`]
+
+ template <class Rep> struct treat_as_floating_point
+ : boost::is_floating_point<Rep> {};
+
+The `duration` template uses the `treat_as_floating_point` trait to help determine if a `duration` with one tick period can be converted to another `duration` with a different tick period. If `treat_as_floating_point<Rep>::value` is `true`, then `Rep` is a floating point type and implicit conversions are allowed among `duration`s. Otherwise, the implicit convertibility depends on the tick periods of the `duration`s. If `Rep` is a class type which emulates a floating point type, the author of `Rep` can specialize `treat_as_floating_point` so that `duration` will treat this `Rep` as if it were a floating point type. Otherwise `Rep` is assumed to be an integral type, or a class emulating an integral type.
+
+
+[endsect]
+[section:duration_values Class template `duration_values`]
+
+ template <class Rep>
+ struct duration_values
+ {
+ public:
+ static BOOST_CONSTEXPR Rep zero();
+ static BOOST_CONSTEXPR Rep max();
+ static BOOST_CONSTEXPR Rep min();
+ };
+
+The `duration` template uses the `duration_values` trait to construct special values of the `duration`s representation (`Rep`). This is done because the representation might be a class type with behavior which requires some other implementation to return these special values. In that case, the author of that class type should specialize `duration_values` to return the indicated values.
+
+[section:zero Static member function`zero()`]
+
+ static BOOST_CONSTEXPR Rep zero();
+
+[*Returns:] `Rep(0)`. [*Note:] `Rep(0)` is specified instead of `Rep()` since `Rep()` may have some other meaning, such as an uninitialized value.
+
+[*Remarks:] The value returned shall correspond to the additive identity.
+
+[endsect]
+[section:max Static member function `max()`]
+
+ static BOOST_CONSTEXPR Rep max();
+
+[*Returns:] `numeric_limits<Rep>::max()`.
+
+[*Remarks:] The value returned shall compare greater than zero().
+
+[endsect]
+[section:min Static member function `min()`]
+
+ static BOOST_CONSTEXPR Rep min();
+
+[*Returns:] `numeric_limits<Rep>::lowest()`.
+
+[*Remarks:] The value returned shall compare less than or equal to `zero()`.
+
+[endsect]
+
+[endsect]
+
+[section `common_type` specializations]
+
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ struct common_type<chrono::duration<Rep1, Period1>, chrono::duration<Rep2, Period2> >
+ {
+ typedef chrono::duration<typename common_type<Rep1, Rep2>::type, see below> type;
+ };
+
+The period of the `duration` indicated by this specialization of `common_type` shall be the greatest common divisor of `Period1` and `Period2`. This can be computed by forming a `ratio` of the greatest common divisor of `Period1::num` and `Period2::num`, and the least common multiple of `Period1::den` and `Period2::den`.
+
+[*Note:] The typedef type is the `duration` with the largest tick period possible where both `duration` arguments will convert to it without requiring a division operation. The representation of this type is intended to be able to hold any value resulting from this conversion, with the possible exception of round-off error when floating point `duration`s are involved (but not truncation error).
+
+ template <class Clock, class Duration1, class Duration2>
+ struct common_type<chrono::time_point<Clock, Duration1>, chrono::time_point<Clock, Duration2> >
+ {
+ typedef chrono::time_point<Clock, typename common_type<Duration1, Duration2>::type> type;
+ };
+
+The `common_type` of two `time_point`s is a `time_point` with the same `clock` (both shall have the same `clock`), and the `common_type` of the two `duration`s.
+
+[endsect]
+
+
+[endsect]
+
+[section Class template `duration`]
+
+A `duration` measures time between two points in time (`time_point`). A `duration` has a representation which holds a count of ticks, and a tick period. The tick period is the amount of time which occurs from one tick to another in units of a second. It is expressed as a rational constant using `ratio`.
+
+ namespace boost { namespace chrono {
+
+ template <class Rep, class Period>
+ class duration {
+ public:
+ typedef Rep rep;
+ typedef Period period;
+ private:
+ rep rep_; // exposition only
+ public:
+ BOOST_CONSTEXPR duration() {} // = default;
+ template <class Rep2>
+ BOOST_CONSTEXPR explicit duration(const Rep2& r,
+ typename boost::enable_if_c
+ <
+ boost::is_convertible<Rep2, rep>::value
+ && (treat_as_floating_point<rep>::value
+ || (!treat_as_floating_point<rep>::value
+ && !treat_as_floating_point<Rep2>::value))
+ >::type* = 0);
+
+ template <class Rep2, class Period2>
+ BOOST_CONSTEXPR duration(const duration<Rep2, Period2>& d,
+ typename boost::enable_if_c
+ <
+ treat_as_floating_point<rep>::value
+ || (ratio_divide<Period2, period>::type::den == 1
+ && !treat_as_floating_point<Rep2>::value)
+ >::type* = 0);
+
+ //~duration() = default;
+ //duration(const duration&) = default;
+ //duration& operator=(const duration&) = default;
+
+ BOOST_CONSTEXPR rep count() const;
+
+ BOOST_CONSTEXPR duration operator+();
+ BOOST_CONSTEXPR duration operator-();
+ duration& operator++();
+ duration operator++(int);
+ duration& operator--();
+ duration operator--(int);
+
+ duration& operator+=(const duration& d);
+ duration& operator-=(const duration& d);
+
+ duration& operator*=(const rep& rhs);
+ duration& operator/=(const rep& rhs);
+ duration& operator%=(const rep& rhs);
+ duration& operator%=(const duration& rhs);
+
+ static BOOST_CONSTEXPR duration zero();
+ static BOOST_CONSTEXPR duration min();
+ static BOOST_CONSTEXPR duration max();
+ };
+
+ }}
+
+Rep shall be an arithmetic type, or a class emulating an arithmetic type. If `duration` is instantiated with the type of `Rep` being a `duration`, a diagnostic is required.
+
+Period shall be an instantiation of `ratio`, diagnostic required.
+
+Period::num shall be positive, diagnostic required.
+
+Examples:
+
+ duration<long, ratio<60> > holds a count of minutes using a long.
+
+ duration<long long, milli> holds a count of milliseconds using a long long.
+
+ duration<double, ratio<1, 30> > holds a count using a double with a tick period of 1/30 second (a tick frequency of 30 Hz).
+
+The following members of `duration` do not throw an exception unless the indicated operations on the representations throw an exception.
+
+[section:duration_c_1 Constructor `duration(const Rep2&)`]
+
+ template <class Rep2>
+ BOOST_CONSTEXPR explicit duration(const Rep2& r);
+
+[*Requires:] `Rep2` is implicitly convertible to `rep`, and
+
+* `treat_as_floating_point<rep>::value` is `true`, or
+* `!treat_as_floating_point<rep>::value && !treat_as_floating_point<Rep2>::value` is `true`.
+
+A diagnostic is required if this requirement is not met. [*Note:] This requirement prevents construction of an integral-based `duration` with a floating point representation. Such a construction could easily lead to confusion about the value of the `duration`.
+
+[*Example:]
+
+ duration<int, milli> d(3.5); // shall not compile
+ duration<int, milli> d(3); // ok
+
+[*Effects:] Constructs an object of type `duration`.
+
+[*PostConditions:] `count() == static_cast<rep>(r)`.
+
+[endsect]
+[section:duration_c_2 Constructor `duration(const duration&)`]
+
+ template <class Rep2, class Period2>
+ BOOST_CONSTEXPR duration(const duration<Rep2, Period2>& d);
+
+[*Requires:] `treat_as_floating_point<rep>::value`, or `ratio_divide<Period2, period>::type::den == 1`.
+
+ A diagnostic is required if this requirement is not met.
+
+[*note] This requirement prevents implicit truncation error when converting between integral-based `duration`s. Such a construction could easily lead to confusion about the value of the `duration`.
+
+[*Example:]
+
+ duration<int, milli> ms(3);
+ duration<int, micro> us = ms; // ok
+ duration<int, milli> ms2 = us; // shall not compile
+
+[*Effects:] Constructs an object of type `duration`, constructing `rep_` from `duration_cast<duration>(d).count()`.
+
+[endsect]
+[section:count Member function `count() const`]
+
+ BOOST_CONSTEXPR rep count() const;
+
+[*Returns:] `rep_v.
+
+[endsect]
+[section:duration_operator_p Member function `operator+() const`]
+
+ BOOST_CONSTEXPR duration operator+() const;
+
+[*Returns:] `*this`.
+
+[endsect]
+[section:duration_operator_m Member function `operator+() const`]
+
+ BOOST_CONSTEXPR duration operator-() const;
+
+[*Returns:] `duration(-rep_)`.
+
+[endsect]
+[section:duration_operator_pp Member function `operator++()`]
+
+ duration& operator++();
+
+[*Effects:] `++rep_`.
+
+[*Returns:] `*this`.
+
+[endsect]
+[section:duration_operator_pp2 Member function `operator++(int)`]
+
+ duration operator++(int);
+
+[*Returns:] `duration(rep_++)v.
+
+[endsect]
+[section:duration_operator_mm Member function `operator++()`]
+
+ duration& operator--();
+
+[*Effects:] `--rep_`.
+
+[*Returns:] `*this`.
+
+[endsect]
+[section:duration_operator_mm2 Member function `operator++(int)`]
+
+ duration operator--(int);
+
+[*Returns:] `duration(rep_--)`.
+
+[endsect]
+[section:duration_operator_pa Member function `operator+=(const duration&)`]
+
+ duration& operator+=(const duration& d);
+
+[*Effects:] `rep_ += d.count()`.
+
+[*Returns:] `*this`.
+
+[endsect]
+[section:duration_operator_ma Member function `operator-=(const duration&)`]
+
+ duration& operator-=(const duration& d);
+
+[*Effects:] `rep_ -= d.count()`.
+
+[*Returns:] `*this`.
+
+[endsect]
+[section:duration_operator_moda Member function `operator%=(const duration&)`]
+
+ duration& operator%=(const duration& d);
+
+[*Effects:] `rep_ %= d.count()`.
+
+[*Returns:] `*this`.
+
+[endsect]
+[section:duration_operator_proda Member function `operator*=(const rep&)`]
+
+ duration& operator*=(const rep& rhs);
+
+[*Effects:] `rep_ *= rhs`.
+
+[*Returns:] `*this`.
+
+[endsect]
+[section:duration_operator_da Member function `operator/=(const rep&)`]
+
+ duration& operator/=(const rep& rhs);
+
+[*Effects:] `rep_ /= rhs`.
+
+[*Returns:] `*this`.
+
+[endsect]
+[section:duration_operator_moda_2 Member function `operator%=(const rep&)`]
+
+ duration& operator%=(const rep& rhs);
+
+[*Effects:] `rep_ %= rhs`.
+
+[*Returns:] `*this`.
+
+[endsect]
+
+
+[section:duration_zero Static Member function `zero()`]
+
+ static duration zero();
+
+[*Returns:] `duration(duration_values<rep>::zero())`.
+
+[endsect]
+[section:duration_min Static Member function `min()`]
+
+ static duration min();
+
+[*Returns:] `duration(duration_values<rep>::min()).`
+
+[endsect]
+[section:duration_max Static Member function `max()`]
+
+ static constexpr duration max();
+
+[*Returns:] `duration(duration_values<rep>::max())`.
+
+[endsect]
+
+[endsect]
+
+
+[section duration non-member arithmetic]
+
+[section:duration_operator_p_1 Non-Member function `operator+(duration,duration)`]
+
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2> >::type
+ operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+[*Returns:] `CD(lhs) += rhs` where `CD` is the type of the return value.
+
+[endsect]
+[section:duration_operator_m_1 Non-Member function `operator-(duration,duration)`]
+
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2> >::type
+ operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+[*Returns:] `CD(lhs) -= rhs` where `CD` is the type of the return value.
+
+ template <class Rep1, class Period, class Rep2>
+ duration<typename common_type<Rep1, Rep2>::type, Period>
+ operator*(const duration<Rep1, Period>& d, const Rep2& s);
+
+[*Requires:] Let `CR` represent the `common_type` of `Rep1` and `Rep2`. Both `Rep1` and `Rep2` shall be implicitly convertible to `CR`, diagnostic required.
+
+[*Returns:] `duration<CR, Period>(d) *= s`.
+
+[endsect]
+[section:duration_operator_prod_1 Non-Member function `operator*(Rep1,duration)`]
+
+ template <class Rep1, class Period, class Rep2>
+ duration<typename common_type<Rep1, Rep2>::type, Period>
+ operator*(const Rep1& s, const duration<Rep2, Period>& d);
+
+[*Requires:] Let `CR` represent the `common_type` of `Rep1` and `Rep2`. Both `Rep1` and `Rep2` shall be implicitly convertible to `CR`, diagnostic required.
+
+[*Returns:] `d * s`.
+
+[endsect]
+[section:duration_operator_d_1 Non-Member function `operator/(duration,Rep2)`]
+
+ template <class Rep1, class Period, class Rep2>
+ duration<typename common_type<Rep1, Rep2>::type, Period>
+ operator/(const duration<Rep1, Period>& d, const Rep2& s);
+
+[*Requires:] Let `CR` represent the `common_type` of `Rep1` and `Rep2`. Both `Rep1` and `Rep2` shall be implicitly convertible to `CR`, and `Rep2` shall not be an instantiation of `duration`, diagnostic required.
+
+[*Returns:] `duration<CR, Period>(d) /= s`.
+
+[endsect]
+[section:duration_operator_d_2 Non-Member function `operator/(duration,duration)`]
+
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ typename common_type<Rep1, Rep2>::type
+ operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+[*Returns:] Let `CD` represent the `common_type` of the two `duration` arguments. Returns `CD(lhs).count() / CD(rhs).count()`.
+
+[endsect]
+
+[endsect]
+
+[section duration comparaisons]
+
+[section:duration_operator_eq_1 Non-Member function `operator==(duration,duration)`]
+
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+[*Returns:] Let `CD` represent the `common_type` of the two `duration` arguments. Returns `CD(lhs).count() == CD(rhs).count()`
+
+[endsect]
+[section:duration_operator_neq_1 Non-Member function `operator!=(duration,duration)`]
+
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+[*Returns:] `!(lhs == rhs)`.
+
+[endsect]
+[section:duration_operator_lt_1 Non-Member function `operator<(duration,duration)`]
+
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+[*Returns:] Let `CD` represent the `common_type` of the two `duration` arguments. Returns `CD(lhs).count() < CD(rhs).count()`
+
+[endsect]
+[section:duration_operator_leq_1 Non-Member function `operator<=(duration,duration)`]
+
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+[*Returns:] `!(rhs < lhs)`.
+
+[endsect]
+[section:duration_operator_gt_1 Non-Member function `operator>(duration,duration)`]
+
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+[*Returns:] `rhs < lhs`.
+
+[endsect]
+[section:duration_operator_gteq_1 Non-Member function `operator>=(duration,duration)`]
+
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
+
+[*Returns:] `!(lhs < rhs)`.
+
+[endsect]
+[endsect]
+[section:duration_cast Non-Member function `duration_cast(duration)`]
+
+ template <class ToDuration, class Rep, class Period>
+ ToDuration duration_cast(const duration<Rep, Period>& d);
+
+[*Requires:] `ToDuration` is an instantiation of `duration`, diagnostic required.
+
+[*Returns:] Forms `CF` which is a `ratio` resulting from `ratio_divide<Period, typename ToDuration::period>::type`. Let `CR` be the `common_type` of `ToDuration::rep`, `Rep`, and `intmax_t`.
+
+* If `CF::num == 1` and `CF::den == 1`, then returns `ToDuration(static_cast<typename ToDuration::rep>(d.count())) `
+* else if `CF::num != 1` and `CF::den == 1`, then returns
+ `ToDuration(static_cast<typename ToDuration::rep>(static_cast<CR>(d.count()) *
+ static_cast<CR>(CF::num)))`
+* else if `CF::num == 1` and `CF::den != 1`, then returns
+ `ToDuration(static_cast<typename ToDuration::rep>(static_cast<CR>(d.count()) /
+ static_cast<CR>(CF::den)))`
+* else returns
+ `ToDuration(static_cast<typename ToDuration::rep>(static_cast<CR>(d.count()) *
+ static_cast<CR>(CF::num) /
+ static_cast<CR>(CF::den)))`
+
+[*Remarks:] This function shall not rely on any implicit conversions. All conversions shall be accomplished through `static_cast`. The implementation shall avoid all multiplications or divisions when it is known at compile time that it can be avoided because one or more arguments are `1`. All intermediate computations shall be carried out in the widest possible representation and only converted to the destination representation at the final step.
+
+
+[endsect]
+
+
+
+[section Class template `time_point`]
+
+A `time_point` represents a point in time with respect to a specific clock.
+
+ template <class Clock, class Duration>
+ class time_point {
+ public:
+ typedef Clock clock;
+ typedef Duration duration;
+ typedef typename duration::rep rep;
+ typedef typename duration::period period;
+ private:
+ duration d_; // exposition only
+ public:
+ time_point();
+ explicit time_point(const duration& d);
+
+ // conversions
+ template <class Duration2>
+ time_point(const time_point<clock, Duration2>& t,
+ typename boost::enable_if
+ <
+ boost::is_convertible<Duration2, duration>
+ >::type* = 0);
+
+ // observer
+
+ duration time_since_epoch() const;
+
+ // arithmetic
+
+ time_point& operator+=(const duration& d);
+ time_point& operator-=(const duration& d);
+
+ // special values
+
+ static BOOST_CONSTEXPR time_point min();
+ static BOOST_CONSTEXPR time_point max();
+ };
+
+Clock shall meet the Clock Requirements.
+
+Duration shall be an instantiation of `duration`, diagnostic required.
+
+[section:time_point_c_1 Constructor `time_point()`]
+
+ time_point();
+
+[*Effects:] Constructs an object of `time_point`, initializing `d_` with `duration::zero()`. This `time_point` represents the epoch.
+
+[endsect]
+[section:time_point_c_2 Constructor `time_point(const duration&)`]
+
+ time_point(const duration& d);
+
+[*Effects:] Constructs an object of `time_point`, initializing `d_` with `d`. This `time_point` represents the epoch `+ d`.
+
+[endsect]
+[section:time_point_c_3 Constructor `time_point(const duration&)`]
+
+ template <class Duration2> time_point(const time_point<clock, Duration2>& t);
+
+[*Requires:] `Duration2` shall be implicitly convertible to `duration`, diagnostic required.
+
+[*Effects:] Constructs an object of `time_point`, initializing `d_` with `t.time_since_epoch()`.
+
+[endsect]
+
+[section:time_since_epoch Member function `time_since_epoch() const`]
+
+ duration time_since_epoch() const;
+
+[*Returns:] `d_`.
+
+[endsect]
+[section:time_point_operator_pe Member function `operator+=`]
+
+ time_point& operator+=(const duration& d);
+
+[*Effects:] `d_ += d`.
+
+[*Returns:] `*this`.
+
+[endsect]
+[section:time_point_operator_me Member function `operator-=`]
+
+ time_point& operator-=(const duration& d);
+
+[*Effects:] `d_ -= d`
+
+[*Returns:] `*this`.
+
+[endsect]
+[section:time_point_min Static Member function `min`]
+
+ static BOOST_CONSTEXPR time_point min();
+
+[*Returns:] `time_point(duration::min())`.
+
+[endsect]
+[section:time_point_max Static Member function `max`]
+
+ static BOOST_CONSTEXPR time_point max();
+
+[*Returns:] `time_point(duration::max())`.
+
+[endsect]
+[endsect]
+
+
+[section time_point non-member arithmetic]
+
+
+[section:time_point_operator_p_1 Non-Member function `operator+(time_point,duration)`]
+
+ template <class Clock, class Duration1, class Rep2, class Period2>
+ time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2> >::type>
+ operator+(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
+
+[*Returns:] `CT(lhs) += rhs` where `CT` is the type of the return value.
+
+[endsect]
+[section:time_point_operator_p_2 Non-Member function `operator+(duration,time_point)`]
+
+ template <class Rep1, class Period1, class Clock, class Duration2>
+ time_point<Clock, typename common_type<duration<Rep1, Period1>, Duration2>::type>
+ operator+(const duration<Rep1, Period1>& lhs, const time_point<Clock, Duration2>& rhs);
+
+[*Returns:] `rhs + lhs`.
+
+[endsect]
+[section:time_point_operator_m_1 Non-Member function `operator-(time_point,duration)`]
+
+ template <class Clock, class Duration1, class Rep2, class Period2>
+ time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2> >::type>
+ operator-(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
+
+[*Returns:] `lhs + (-rhs)`.
+
+[endsect]
+[section:time_point_operator_m_2 Non-Member function `operator-(duration,time_point)`]
+
+ template <class Clock, class Duration1, class Duration2>
+ typename common_type<Duration1, Duration2>::type
+ operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
+
+[*Returns:] `lhs.time_since_epoch() - rhs.time_since_epoch()`.
+
+[endsect]
+[endsect]
+
+[section time_point comparisons]
+[section:time_point_operator_eq Non-Member function `operator==(time_point,time_point)`]
+
+ template <class Clock, class Duration1, class Duration2>
+ bool operator==(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
+
+[*Returns:] `lhs.time_since_epoch() == rhs.time_since_epoch()`.
+
+[endsect]
+[section:time_point_operator_neq Non-Member function `operator!=(time_point,time_point)`]
+
+template <class Clock, class Duration1, class Duration2>
+ bool operator!=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
+
+[*Returns:] `!(lhs == rhs)`.
+
+[endsect]
+[section:time_point_operator_lt Non-Member function `operator<(time_point,time_point)`]
+
+ template <class Clock, class Duration1, class Duration2>
+ bool operator< (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
+
+[*Returns:] lhs.time_since_epoch() < rhs.time_since_epoch().
+
+[endsect]
+[section:time_point_operator_leq Non-Member function `operator<=(time_point,time_point)`]
+
+ template <class Clock, class Duration1, class Duration2>
+ bool operator<=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
+
+[*Returns:] `!(rhs < lhs)`.
+
+[endsect]
+[section:time_point_operator_gt Non-Member function `operator>(time_point,time_point)`]
+
+template <class Clock, class Duration1, class Duration2>
+ bool operator> (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
+
+[*Returns:] `rhs < lhs`.
+
+[endsect]
+[section:time_point_operator_geq Non-Member function `operator>=(time_point,time_point)`]
+
+ template <class Clock, class Duration1, class Duration2>
+ bool operator>=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
+
+[*Returns:] `!(lhs < rhs)`.
+
+[endsect]
+[section:time_point_cast Non-Member function `time_point_cast(time_point)`]
+
+ template <class ToDuration, class Clock, class Duration>
+ time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t);
+
+[*Requires:] `ToDuration` is an instantiation of `duration`, diagnostic required.
+
+[*Returns:] `time_point<Clock, ToDuration>(duration_cast<ToDuration>(t.time_since_epoch()))`.
+
+[endsect]
+[endsect]
+
+
+[section Class `system_clock`]
+
+
+ class system_clock {
+ public:
+ typedef BOOST_SYSTEM_CLOCK_DURATION duration;
+ typedef duration::rep rep;
+ typedef duration::period period;
+ typedef chrono::time_point<system_clock> time_point;
+ static const bool is_monotonic = <unspecified>;
+
+ static time_point now(); // throws on error
+ static time_point now(system::error_code & ec); // never throws
+
+ static std::time_t to_time_t(const time_point& t);
+ static time_point from_time_t(std::time_t t);
+ };
+
+`system_clock::duration::min() < system_clock::duration::zero()` shall be `true`.
+
+
+[section:to_time_t Non-Member function `to_time_t(time_point)`]
+
+time_t to_time_t(const time_point& t);
+
+[*Returns:] A `time_t` such that the `time_t` and `t` represent the same point in time, truncated to the courser of the precisions among `time_t` and `t`.
+
+[endsect]
+[section:from_time_t Non-Member function `from_time_t(time_t)`]
+
+ time_point from_time_t(time_t t);
+
+[*Returns:] A `time_point` such that the `time_point` and `t` represent the same point in time, truncated to the courser of the precisions among `time_point` and `t`.
+
+[endsect]
+[endsect]
+
+[section Class `monotonic_clock`]
+
+`monotonic_clock` satisfy the Clock Requirements.
+
+ #ifdef BOOST_HAS_CLOCK_MONOTONIC
+ class BOOST_CHRONO_DECL monotonic_clock {
+ public:
+ typedef nanoseconds duration;
+ typedef duration::rep rep;
+ typedef duration::period period;
+ typedef chrono::time_point<monotonic_clock> time_point;
+ static const bool is_monotonic = true;
+
+ static time_point now(); // throws on error
+ static time_point now(system::error_code & ec); // never throws
+ };
+ #endif
+
+[endsect]
+
+[section Class `high_resolution_clock`]
+
+`high_resolution_clock` satisfy the Clock Requirements.
+
+ #ifdef BOOST_CHRONO_HAS_CLOCK_MONOTONIC
+ typedef monotonic_clock high_resolution_clock; // as permitted by [time.clock.hires]
+ #else
+ typedef system_clock high_resolution_clock; // as permitted by [time.clock.hires]
+ #endif
+
+[endsect]
+
+[endsect]
+
+[/==========================================================================================]
+[section:timer_hpp Header `<boost/chrono/timer.hpp>`]
+[/==========================================================================================]
+
+ namespace boost { namespace chrono {
+
+ template <class Clock> class timer {
+ public:
+ typedef Clock clock;
+ typedef typename Clock::duration duration;
+ typedef typename Clock::time_point time_point;
+
+ explicit timer( system::error_code & ec = system::throws );
+
+ ~timer();
+
+ void start( system::error_code & ec = system::throws );
+ duration elapsed( system::error_code & ec = system::throws );
+
+ };
+
+ typedef boost::chrono::timer< boost::chrono::system_clock > system_timer;
+ #ifdef BOOST_CHRONO_HAS_CLOCK_MONOTONIC
+ typedef boost::chrono::timer< boost::chrono::monotonic_clock > monotonic_timer;
+ #endif
+ typedef boost::chrono::timer< boost::chrono::high_resolution_clock > high_resolution_timer;
+
+ } }
+
+
+[endsect]
+
+[/==========================================================================================]
+[section:process_times_hpp Header `<boost/chrono/process_times.hpp>`]
+[/==========================================================================================]
+
+ namespace boost { namespace chrono {
+
+ struct process_times;
+
+ class process_clock {
+ public:
+ typedef nanoseconds duration;
+ typedef duration::rep rep;
+ typedef duration::period period;
+ typedef chrono::time_point<process_clock> time_point;
+ static const bool is_monotonic = true;
+
+ static void now( process_times & times,
+ system::error_code & ec = system::throws );
+ };
+
+ struct process_times {
+ process_clock::duration real; // real (i.e wall clock) time
+ process_clock::duration user; // user cpu time
+ process_clock::duration system; // system cpu time
+ };
+
+ class process_timer {
+ public:
+ typedef process_clock clock;
+ typedef process_clock::duration duration;
+ typedef process_clock::time_point time_point;
+
+ explicit process_timer( system::error_code & ec = system::throws );
+
+ ~process_timer();
+ void start( system::error_code & ec = system::throws );
+ void elapsed( process_times & times, system::error_code & ec = system::throws );
+ };
+
+ class run_timer : public process_timer {
+ public:
+
+ explicit run_timer( system::error_code & ec = system::throws );
+ explicit run_timer( std::ostream & os,
+ system::error_code & ec = system::throws );
+
+ explicit run_timer( const std::string & format,
+ system::error_code & ec = system::throws );
+ explicit run_timer( std::ostream & os, const std::string & format,
+ system::error_code & ec = system::throws );
+
+ explicit run_timer( const std::string & format, int places,
+ system::error_code & ec = system::throws );
+ explicit run_timer( std::ostream & os, const std::string & format, int places,
+ system::error_code & ec = system::throws );
+
+ explicit run_timer( int places,
+ system::error_code & ec = system::throws );
+ explicit run_timer( std::ostream & os, int places,
+ system::error_code & ec = system::throws );
+
+ explicit run_timer( int places, const std::string & format,
+ system::error_code & ec = system::throws );
+ explicit run_timer( std::ostream & os, int places, const std::string & format,
+ system::error_code & ec = system::throws );
+
+ ~run_timer();
+
+ void start( system::error_code & ec = system::throws );
+
+ void report( system::error_code & ec = system::throws );
+
+ void test_report( duration real_, duration user_, duration system_ );
+ bool reported() const;
+ static int default_places();
+ };
+
+ } // namespace chrono
+ } // namespace boost
+
+
+[endsect]
+
+[endsect]
+
+[section Examples]
+
+[section SI-units]
+
+Type-safe "physics" code interoperating with std::chrono::duration types and taking advantage of the std::ratio infrastructure and design philosophy.
+
+[/ratio_test_cpp]
+
+[endsect]
+
+
+[section How you override the duration's default constructor]
+
+How you override the duration's default constructor to do anything you want (in this case zero)
+
+[/i_dont_like_the_default_duration_behavior_cpp]
+
+[endsect]
+
+[section min utility]
+
+Returns the earliest time_point.
+
+ template <class Clock, class Duration1, class Duration2>
+ typename boost::common_type<time_point<Clock, Duration1>,
+ time_point<Clock, Duration2> >::type
+ min(time_point<Clock, Duration1> t1, time_point<Clock, Duration2> t2)
+ {
+ return t2 < t1 ? t2 : t1;
+ }
+
+Being able to *easily* write this function is a major feature!
+
+ typedef time_point<system_clock,
+ boost::common_type<system_clock::duration, seconds>::type> T1;
+ typedef time_point<system_clock,
+ boost::common_type<system_clock::duration, nanoseconds>::type> T2;
+ typedef boost::common_type<T1, T2>::type T3;
+ /*auto*/ T1 t1 = system_clock::now() + seconds(3);
+ /*auto*/ T2 t2 = system_clock::now() + nanoseconds(3);
+ /*auto*/ T3 t3 = min(t1, t2);
+
+
+[endsect]
+
+[section Cycle count]
+
+How you override the duration's default constructor to do anything you want (in this case zero)
+
+[/cycle_count_cpp]
+
+[endsect]
+
+[section xtime_clock]
+
+
+[/xtime_clock_cpp]
+
+[endsect]
+
+[section runtime_resolution]
+
+
+[/runtime_resolution_cpp]
+
+[endsect]
+
+[section Simulated thread interface demonstration program]
+
+[/simulated_thread_interface_demo_cpp]
+
+[endsect]
+
+
+
+[section saturating]
+
+A "saturating" signed integral type is developed. This type has +/- infinity and a nan (like IEEE floating point) but otherwise obeys signed integral arithmetic. This class is subsequently used as the rep in boost::chrono::duration to demonstrate a duration class that does not silently ignore overflow.
+
+[/ratio_test_cpp]
+
+[endsect]
+
+[section Howard Hinnant's original demonstration program]
+
+[/time2_demo_cpp]
+
+[endsect]
+
+[section A tiny program that times how long until a key is struck]
+
+[/await_keystroke_cpp]
+
+[endsect]
+
+[section run_timer_example.cpp]
+
+Here is the run_timer_example.cpp program supplied with the Boost Chrono library:
+
+[/run_timer_example_cpp]
+
+When the run_timer t object is created, it starts timing. When it is destroyed at the end of the program, its destructor stops the timer and displays timing information on cout.
+
+The output of this program run on a circa 2006 processor looks was this:
+
+ wall 0.42 s, user 0.41 s + system 0.00 s = total cpu 0.41 s, (96.3%)
+
+In other words, this program ran in 0.42 seconds as would be measured by a clock on the wall, the operating system charged it for 0.41 seconds of user CPU time and 0 seconds of system CPU time, the total of these two was 0.41, and that represented 96.3 percent of the wall clock time.
+
+[endsect]
+
+[section run_timer_example2.cpp]
+
+The run_timer_example2.cpp program is the same, except that it supplies additional constructor arguments from the command line:
+
+ #include <boost/system/timer.hpp>
+ #include <cmath>
+
+ int main( int argc, char * argv[] )
+ {
+ const char * format = argc > 1 ? argv[1] : "%t cpu seconds\n";
+ int places = argc > 2 ? std::atoi( argv[2] ) : 2;
+
+ boost::system::run_timer t( format, places );
+
+ for ( long i = 0; i < 10000000; ++i )
+ std::sqrt( 123.456L ); // burn some time
+
+ return 0;
+ }
+
+Here is the output for this program for several sets of command line arguments:
+
+ run_timer_example2
+ 0.42 cpu seconds
+
+ run_timer_example2 "%w wall clock seconds\n"
+ 0.41 wall clock seconds
+
+ run_timer_example2 "%w wall clock seconds\n" 6
+ 0.421875 wall clock seconds
+
+ run_timer_example2 "%t total CPU seconds\n" 3
+ 0.422 total CPU seconds
+
+[endsect]
+
+
+[endsect]
+[/=================]
+[section Appendices]
+[/=================]
+[/==================================]
+[section:history Appendix A: History]
+[/==================================]
+
+[section [*Version 0.2.0, December 8, 2009] ['+ Features + Bug fixes + Updated documentation]]
+
+[*Features:]
+
+* Added ratio construction and assignment from an equivalent ratio.
+* Added nested ratio typedef type.
+* Added BOOST_CHRONO_HAS_CLOCK_MONOTONIC macro to state if monotonic_clock is provided on this platform.
+* Added duration operator%
+* Added BOOST_CONSTEXPR when constexpr should be used
+* Complete duration operator* and operator/
+
+
+[*Implementation:]
+
+* Separate chrono.cpp on # files win/chrono.cpp, mac/chrono.cpp and posix/chrono.cpp to make easier the maintenance on different platforms.
+* Separate process_clock.cpp on # files win/process_clock.cpp, mac/process_clock.cpp and posix/process_clock.cpp to make easir the maintenace on different platforms.
+* Added the error_code prototype for monotonic_clock::now for mac/chono.cpp
+* Fully implement mac/chrono.cpp with error handling.
+* Take care on POSIX systems when CLOCK_MONOTONIC is not defined.
+
+[*Documentation:]
+
+* The documentation is written now using quick-book using as base [@http://www.open-std.org/jtc1/sc22/wg21 [*N2661 - A Foundation to Sleep On]] .
+
+[*Bugs]
+
+* operator/ was ambiguous: Disambiguate duration operator/
+* CLOCK_MONOTONIC is not defined with cygwin/gcc 3.4: Disable code when BOOST_CHRONO_HAS_CLOCK_MONOTONIC is not defined.
+* result of metafunctions ratio_add and ratio_sub were not normalized ratios: Use of the nested ratio typedef type on ratio arithmetic operations.
+* Copy constructor from similar duration masked the defaulted operations: Added duration defaulted implementations
+
+
+[endsect]
+[section [*Version 0.1.0, April 29, 2009] ['Beman's boostified version Chrono]]
+
+[*Features:]
+
+* The C++0x Standard Library's `common_type`.
+* The C++0x Standard Library's compile-time rational arithmetic.
+* The C++0x Standard Library's time utilities, including:
+ * Class template `duration`
+ * Class template `time_point`
+ * Clocks:
+ * `system_clock`
+ * `monotonic_clock`
+ * `high_resolution_clock`
+
+* Class template timer, with typedefs:
+ * `system_timer`
+ * `monotonic_timer`
+ * `high_resolution_timer`
+
+* Process clocks and timers:
+ * `process_clock`, capturing real, user-CPU, and system-CPU times.
+ * `process_timer`, capturing elapsed real, user-CPU, and system-CPU times.
+ * `run_timer`, convenient reporting of process_timer results.
+
+[endsect]
+[endsect]
+
+[section:rationale Appendix B: Rationale]
+
+See [http://www.open-std.org/jtc1/sc22/wg21 [*N2661 - A Foundation to Sleep On]] which is very informative and provides motivation for key design decisions. The following sections are an extract from this document.
+
+[heading Is it possible for the user to pass a `duration` to a function with the units being ambiguous?]
+
+No. No matter which option the author of `f` chooses above, the following client code will not compile:
+
+ f(3); // Will not compile, 3 is not implicitly convertible to any `duration`
+
+
+[endsect]
+
+[section:implementation Appendix C: Implementation Notes]
+
+[heading Caveat emptor]
+
+The underlying clocks provided by operating systems are subject to many seemingly arbitrary policies and implementation irregularities. That's a polite way of saying they tend to be flakey, and each operating system or even each clock has its own cruel and unusual forms of flakiness. Don't bet the farm on their accuracy, unless you have become deeply familiar with exactly what the specific operating system is guaranteeing, which is often very little.
+
+[heading Why does run_timer only display millisecond place precision when the underlying timer has nanosecond precision?]
+
+To avoid giving the impression of precision where none exists. See Caveat emptor. You can always specify additional decimal places if you want to live dangerously.
+
+[heading Why does run_timer sometimes report more cpu seconds than real seconds?]
+
+Ask your operating system supplier. The results have been inspected with a debugger, and both for Windows and Linux, that's what the OS appears to be reporting at times.
+
+[endsect]
+
+[section:acknowledgements Appendix D: Acknowledgements]
+
+The library's code was derived from Howard Hinnant's time2_demo prototype. Many thanks to Howard for making his code available under the Boost license. The original code was modified by Beman Dawes to conform to Boost conventions.
+
+time2_demo contained this comment:
+
+Much thanks to Andrei Alexandrescu, Walter Brown, Peter Dimov, Jeff Garland, Terry Golubiewski, Daniel Krugler, Anthony Williams.
+
+
+[endsect]
+[section Appendix E: Tests]
+
+In order to test you need to do just
+
+ bjam libs/chrono/test
+
+
+[section `ratio`]
+[table
+ [[Name] [kind] [Description] [Result] [Ticket]]
+ [[ratio_fail_1.] [compile-fails] [...] [Pass] [#]]
+ [[ratio_test] [run] [...] [Pass] [#]]
+]
+[endsect]
+
+[section chrono]
+[table
+ [[Name] [kind] [Description] [Result] [Ticket]]
+ [[chrono_unit] [run] [...] [Pass] [#]]
+]
+[endsect]
+
+[section timer]
+[table
+ [[Name] [kind] [Description] [Result] [Ticket]]
+ [[timer.accuracy] [run] [...] [Pass] [#]]
+ [[timer.run_timer_constructor_overload] [run] [...] [Pass] [#]]
+ [[timer.process_timer_test] [run] [...] [Pass] [#]]
+]
+[endsect]
+
+[endsect]
+[section Appendix F: Tickets]
+
+[endsect]
+
+[/=====================================]
+[section:todo Appendix F: Future plans]
+[/=====================================]
+
+[heading Tasks to do before review]
+
+* Fully implement error handling, with test cases.
+* Consider issues raised by Michael Marcin:
+
+'''
+ > In the past I've seen QueryPerformanceCounter give incorrect results,
+ > especially with SpeedStep processors on laptops. This was many years ago and
+ > might have been fixed by service packs and drivers.
+ >
+ > Typically you check the results of QPC against GetTickCount to see if the
+ > results are reasonable.
+ > http://support.microsoft.com/kb/274323
+ >
+ > I've also heard of problems with QueryPerformanceCounter in multi-processor
+ > systems.
+ >
+ > I know some people SetThreadAffinityMask to 1 for the current thread call
+ > their QueryPerformance* functions then restore SetThreadAffinityMask. This
+ > seems horrible to me because it forces your program to jump to another
+ > physical processor if it isn't already on cpu0 but they claim it worked well
+ > in practice because they called the timing functions infrequently.
+ >
+ > In the past I have chosen to use timeGetTime with timeBeginPeriod(1) for
+ > high resolution timers to avoid these issues.
+'''
+
+[heading For later releases]
+
+* Use of C++0x features, such as variadic templates, rvalues, decltype and constexpr, when available.
+* Define a C++98 variadic template emmulation of common_type
+
+[endsect]
+[endsect]

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,67 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Appendices</title>
+<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../index.html" title="Boost.Chrono">
+<link rel="up" href="../index.html" title="Boost.Chrono">
+<link rel="prev" href="examples/run_timer_example2_cpp.html" title="run_timer_example2.cpp">
+<link rel="next" href="appendices/history.html" title=" Appendix A: History">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="examples/run_timer_example2_cpp.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="appendices/history.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_chrono.appendices"></a>Appendices
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"> Appendix A: History</span></dt>
+<dd><dl>
+<dt><span class="section"><a href="appendices/history.html#boost_chrono.appendices.history.__version_0_2_0__december_8__2009______features___bug_fixes___updated_documentation_"><span class="bold"><strong>Version 0.2.0, December 8, 2009</strong></span> <span class="emphasis"><em>+ Features
+ + Bug fixes + Updated documentation</em></span></a></span></dt>
+<dt><span class="section"><a href="appendices/history.html#boost_chrono.appendices.history.__version_0_1_0__april_29__2009____beman_s_boostified_version_chrono_"><span class="bold"><strong>Version 0.1.0, April 29, 2009</strong></span> <span class="emphasis"><em>Beman's boostified
+ version Chrono</em></span></a></span></dt>
+</dl></dd>
+<dt><span class="section"> Appendix B: Rationale</span></dt>
+<dt><span class="section"><a href="appendices/implementation.html"> Appendix C:
+ Implementation Notes</a></span></dt>
+<dt><span class="section"><a href="appendices/acknowledgements.html"> Appendix D:
+ Acknowledgements</a></span></dt>
+<dt><span class="section"><a href="appendices/appendix_e__tests.html">Appendix E:
+ Tests</a></span></dt>
+<dd><dl>
+<dt><span class="section">ratio</span></dt>
+<dt><span class="section">chrono</span></dt>
+<dt><span class="section">timer</span></dt>
+</dl></dd>
+<dt><span class="section"><a href="appendices/appendix_f__tickets.html">Appendix
+ F: Tickets</a></span></dt>
+<dt><span class="section"> Appendix F: Future plans</span></dt>
+</dl></div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="examples/run_timer_example2_cpp.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="appendices/history.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/acknowledgements.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/acknowledgements.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,60 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title> Appendix D:
+ Acknowledgements</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../../index.html" title="Boost.Chrono">
+<link rel="up" href="../appendices.html" title="Appendices">
+<link rel="prev" href="implementation.html" title=" Appendix C:
+ Implementation Notes">
+<link rel="next" href="appendix_e__tests.html" title="Appendix E:
+ Tests">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="implementation.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../appendices.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="appendix_e__tests.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_chrono.appendices.acknowledgements"></a><a href="acknowledgements.html" title=" Appendix D:
+ Acknowledgements"> Appendix D:
+ Acknowledgements</a>
+</h3></div></div></div>
+<p>
+ The library's code was derived from Howard Hinnant's time2_demo prototype.
+ Many thanks to Howard for making his code available under the Boost license.
+ The original code was modified by Beman Dawes to conform to Boost conventions.
+ </p>
+<p>
+ time2_demo contained this comment:
+ </p>
+<p>
+ Much thanks to Andrei Alexandrescu, Walter Brown, Peter Dimov, Jeff Garland,
+ Terry Golubiewski, Daniel Krugler, Anthony Williams.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="implementation.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../appendices.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="appendix_e__tests.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/appendix_e__tests.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/appendix_e__tests.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,347 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Appendix E:
+ Tests</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../../index.html" title="Boost.Chrono">
+<link rel="up" href="../appendices.html" title="Appendices">
+<link rel="prev" href="acknowledgements.html" title=" Appendix D:
+ Acknowledgements">
+<link rel="next" href="appendix_f__tickets.html" title="Appendix
+ F: Tickets">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="acknowledgements.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../appendices.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="appendix_f__tickets.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_chrono.appendices.appendix_e__tests"></a><a href="appendix_e__tests.html" title="Appendix E:
+ Tests">Appendix E:
+ Tests</a>
+</h3></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">ratio</span></dt>
+<dt><span class="section">chrono</span></dt>
+<dt><span class="section">timer</span></dt>
+</dl></div>
+<p>
+ In order to test you need to do just
+ </p>
+<pre class="programlisting"><span class="identifier">bjam</span> <span class="identifier">libs</span><span class="special">/</span><span class="identifier">chrono</span><span class="special">/</span><span class="identifier">test</span>
+</pre>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.appendices.appendix_e__tests._ratio_"></a>ratio
+</h4></div></div></div>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+<col>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Name
+ </p>
+ </th>
+<th>
+ <p>
+ kind
+ </p>
+ </th>
+<th>
+ <p>
+ Description
+ </p>
+ </th>
+<th>
+ <p>
+ Result
+ </p>
+ </th>
+<th>
+ <p>
+ Ticket
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+ ratio_fail_1.
+ </p>
+ </td>
+<td>
+ <p>
+ compile-fails
+ </p>
+ </td>
+<td>
+ <p>
+ ...
+ </p>
+ </td>
+<td>
+ <p>
+ Pass
+ </p>
+ </td>
+<td>
+ <p>
+ #
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ ratio_test
+ </p>
+ </td>
+<td>
+ <p>
+ run
+ </p>
+ </td>
+<td>
+ <p>
+ ...
+ </p>
+ </td>
+<td>
+ <p>
+ Pass
+ </p>
+ </td>
+<td>
+ <p>
+ #
+ </p>
+ </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.appendices.appendix_e__tests.chrono"></a>chrono
+</h4></div></div></div>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+<col>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Name
+ </p>
+ </th>
+<th>
+ <p>
+ kind
+ </p>
+ </th>
+<th>
+ <p>
+ Description
+ </p>
+ </th>
+<th>
+ <p>
+ Result
+ </p>
+ </th>
+<th>
+ <p>
+ Ticket
+ </p>
+ </th>
+</tr></thead>
+<tbody><tr>
+<td>
+ <p>
+ chrono_unit
+ </p>
+ </td>
+<td>
+ <p>
+ run
+ </p>
+ </td>
+<td>
+ <p>
+ ...
+ </p>
+ </td>
+<td>
+ <p>
+ Pass
+ </p>
+ </td>
+<td>
+ <p>
+ #
+ </p>
+ </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.appendices.appendix_e__tests.timer"></a>timer
+</h4></div></div></div>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+<col>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Name
+ </p>
+ </th>
+<th>
+ <p>
+ kind
+ </p>
+ </th>
+<th>
+ <p>
+ Description
+ </p>
+ </th>
+<th>
+ <p>
+ Result
+ </p>
+ </th>
+<th>
+ <p>
+ Ticket
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+ timer.accuracy
+ </p>
+ </td>
+<td>
+ <p>
+ run
+ </p>
+ </td>
+<td>
+ <p>
+ ...
+ </p>
+ </td>
+<td>
+ <p>
+ Pass
+ </p>
+ </td>
+<td>
+ <p>
+ #
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ timer.run_timer_constructor_overload
+ </p>
+ </td>
+<td>
+ <p>
+ run
+ </p>
+ </td>
+<td>
+ <p>
+ ...
+ </p>
+ </td>
+<td>
+ <p>
+ Pass
+ </p>
+ </td>
+<td>
+ <p>
+ #
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ timer.process_timer_test
+ </p>
+ </td>
+<td>
+ <p>
+ run
+ </p>
+ </td>
+<td>
+ <p>
+ ...
+ </p>
+ </td>
+<td>
+ <p>
+ Pass
+ </p>
+ </td>
+<td>
+ <p>
+ #
+ </p>
+ </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="acknowledgements.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../appendices.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="appendix_f__tickets.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/appendix_f__tickets.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/appendix_f__tickets.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,45 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Appendix
+ F: Tickets</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../../index.html" title="Boost.Chrono">
+<link rel="up" href="../appendices.html" title="Appendices">
+<link rel="prev" href="appendix_e__tests.html" title="Appendix E:
+ Tests">
+<link rel="next" href="todo.html" title=" Appendix F: Future plans">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="appendix_e__tests.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../appendices.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="todo.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title">
+<a name="boost_chrono.appendices.appendix_f__tickets"></a><a href="appendix_f__tickets.html" title="Appendix
+ F: Tickets">Appendix
+ F: Tickets</a>
+</h3></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="appendix_e__tests.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../appendices.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="todo.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/history.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/history.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,192 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title> Appendix A: History</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../../index.html" title="Boost.Chrono">
+<link rel="up" href="../appendices.html" title="Appendices">
+<link rel="prev" href="../appendices.html" title="Appendices">
+<link rel="next" href="rationale.html" title=" Appendix B: Rationale">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../appendices.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../appendices.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="rationale.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_chrono.appendices.history"></a> Appendix A: History
+</h3></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="history.html#boost_chrono.appendices.history.__version_0_2_0__december_8__2009______features___bug_fixes___updated_documentation_"><span class="bold"><strong>Version 0.2.0, December 8, 2009</strong></span> <span class="emphasis"><em>+ Features
+ + Bug fixes + Updated documentation</em></span></a></span></dt>
+<dt><span class="section"><a href="history.html#boost_chrono.appendices.history.__version_0_1_0__april_29__2009____beman_s_boostified_version_chrono_"><span class="bold"><strong>Version 0.1.0, April 29, 2009</strong></span> <span class="emphasis"><em>Beman's boostified
+ version Chrono</em></span></a></span></dt>
+</dl></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.appendices.history.__version_0_2_0__december_8__2009______features___bug_fixes___updated_documentation_"></a><a href="history.html#boost_chrono.appendices.history.__version_0_2_0__december_8__2009______features___bug_fixes___updated_documentation_" title="Version 0.2.0, December 8, 2009 + Features
+ + Bug fixes + Updated documentation"><span class="bold"><strong>Version 0.2.0, December 8, 2009</strong></span> <span class="emphasis"><em>+ Features
+ + Bug fixes + Updated documentation</em></span></a>
+</h4></div></div></div>
+<p>
+ <span class="bold"><strong>Features:</strong></span>
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ Added ratio construction and assignment from an equivalent ratio.
+ </li>
+<li>
+ Added nested ratio typedef type.
+ </li>
+<li>
+ Added BOOST_CHRONO_HAS_CLOCK_MONOTONIC macro to state if monotonic_clock
+ is provided on this platform.
+ </li>
+<li>
+ Added duration operator%
+ </li>
+<li>
+ Added BOOST_CONSTEXPR when constexpr should be used
+ </li>
+<li>
+ Complete duration operator* and operator/
+ </li>
+</ul></div>
+<p>
+ <span class="bold"><strong>Implementation:</strong></span>
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ Separate chrono.cpp on # files win/chrono.cpp, mac/chrono.cpp and posix/chrono.cpp
+ to make easier the maintenance on different platforms.
+ </li>
+<li>
+ Separate process_clock.cpp on # files win/process_clock.cpp, mac/process_clock.cpp
+ and posix/process_clock.cpp to make easir the maintenace on different
+ platforms.
+ </li>
+<li>
+ Added the error_code prototype for monotonic_clock::now for mac/chono.cpp
+ </li>
+<li>
+ Fully implement mac/chrono.cpp with error handling.
+ </li>
+<li>
+ Take care on POSIX systems when CLOCK_MONOTONIC is not defined.
+ </li>
+</ul></div>
+<p>
+ <span class="bold"><strong>Documentation:</strong></span>
+ </p>
+<div class="itemizedlist"><ul type="disc"><li>
+ The documentation is written now using quick-book using as base <a href="http://www.open-std.org/jtc1/sc22/wg21" target="_top"><span class="bold"><strong>N2661
+ - A Foundation to Sleep On</strong></span></a> .
+ </li></ul></div>
+<p>
+ <span class="bold"><strong>Bugs</strong></span>
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ operator/ was ambiguous: Disambiguate duration operator/
+ </li>
+<li>
+ CLOCK_MONOTONIC is not defined with cygwin/gcc 3.4: Disable code when
+ BOOST_CHRONO_HAS_CLOCK_MONOTONIC is not defined.
+ </li>
+<li>
+ result of metafunctions ratio_add and ratio_sub were not normalized ratios:
+ Use of the nested ratio typedef type on ratio arithmetic operations.
+ </li>
+<li>
+ Copy constructor from similar duration masked the defaulted operations:
+ Added duration defaulted implementations
+ </li>
+</ul></div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.appendices.history.__version_0_1_0__april_29__2009____beman_s_boostified_version_chrono_"></a><a href="history.html#boost_chrono.appendices.history.__version_0_1_0__april_29__2009____beman_s_boostified_version_chrono_" title="Version 0.1.0, April 29, 2009 Beman's boostified
+ version Chrono"><span class="bold"><strong>Version 0.1.0, April 29, 2009</strong></span> <span class="emphasis"><em>Beman's boostified
+ version Chrono</em></span></a>
+</h4></div></div></div>
+<p>
+ <span class="bold"><strong>Features:</strong></span>
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ The C++0x Standard Library's <code class="computeroutput"><span class="identifier">common_type</span></code>.
+ </li>
+<li>
+ The C++0x Standard Library's compile-time rational arithmetic.
+ </li>
+<li>
+ The C++0x Standard Library's time utilities, including:
+ <div class="itemizedlist"><ul type="circle">
+<li>
+ Class template <code class="computeroutput"><span class="identifier">duration</span></code>
+</li>
+<li>
+ Class template <code class="computeroutput"><span class="identifier">time_point</span></code>
+</li>
+<li>
+ Clocks:
+ <div class="itemizedlist"><ul type="square">
+<li><code class="computeroutput"><span class="identifier">system_clock</span></code></li>
+<li><code class="computeroutput"><span class="identifier">monotonic_clock</span></code></li>
+<li><code class="computeroutput"><span class="identifier">high_resolution_clock</span></code></li>
+</ul></div>
+</li>
+</ul></div>
+</li>
+<li>
+ Class template timer, with typedefs:
+ <div class="itemizedlist"><ul type="circle">
+<li><code class="computeroutput"><span class="identifier">system_timer</span></code></li>
+<li><code class="computeroutput"><span class="identifier">monotonic_timer</span></code></li>
+<li><code class="computeroutput"><span class="identifier">high_resolution_timer</span></code></li>
+</ul></div>
+</li>
+<li>
+ Process clocks and timers:
+ <div class="itemizedlist"><ul type="circle">
+<li>
+<code class="computeroutput"><span class="identifier">process_clock</span></code>, capturing
+ real, user-CPU, and system-CPU times.
+ </li>
+<li>
+<code class="computeroutput"><span class="identifier">process_timer</span></code>, capturing
+ elapsed real, user-CPU, and system-CPU times.
+ </li>
+<li>
+<code class="computeroutput"><span class="identifier">run_timer</span></code>, convenient
+ reporting of process_timer results.
+ </li>
+</ul></div>
+</li>
+</ul></div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../appendices.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../appendices.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="rationale.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/implementation.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/implementation.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,81 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title> Appendix C:
+ Implementation Notes</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../../index.html" title="Boost.Chrono">
+<link rel="up" href="../appendices.html" title="Appendices">
+<link rel="prev" href="rationale.html" title=" Appendix B: Rationale">
+<link rel="next" href="acknowledgements.html" title=" Appendix D:
+ Acknowledgements">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="rationale.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../appendices.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="acknowledgements.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_chrono.appendices.implementation"></a><a href="implementation.html" title=" Appendix C:
+ Implementation Notes"> Appendix C:
+ Implementation Notes</a>
+</h3></div></div></div>
+<a name="boost_chrono.appendices.implementation.caveat_emptor"></a><h4>
+<a name="id4853495"></a>
+ <a href="implementation.html#boost_chrono.appendices.implementation.caveat_emptor">Caveat
+ emptor</a>
+ </h4>
+<p>
+ The underlying clocks provided by operating systems are subject to many seemingly
+ arbitrary policies and implementation irregularities. That's a polite way
+ of saying they tend to be flakey, and each operating system or even each
+ clock has its own cruel and unusual forms of flakiness. Don't bet the farm
+ on their accuracy, unless you have become deeply familiar with exactly what
+ the specific operating system is guaranteeing, which is often very little.
+ </p>
+<a name="boost_chrono.appendices.implementation.why_does_run_timer_only_display_millisecond_place_precision_when_the_underlying_timer_has_nanosecond_precision_"></a><h4>
+<a name="id4853528"></a>
+ <a href="implementation.html#boost_chrono.appendices.implementation.why_does_run_timer_only_display_millisecond_place_precision_when_the_underlying_timer_has_nanosecond_precision_">Why
+ does run_timer only display millisecond place precision when the underlying
+ timer has nanosecond precision?</a>
+ </h4>
+<p>
+ To avoid giving the impression of precision where none exists. See Caveat
+ emptor. You can always specify additional decimal places if you want to live
+ dangerously.
+ </p>
+<a name="boost_chrono.appendices.implementation.why_does_run_timer_sometimes_report_more_cpu_seconds_than_real_seconds_"></a><h4>
+<a name="id4853569"></a>
+ <a href="implementation.html#boost_chrono.appendices.implementation.why_does_run_timer_sometimes_report_more_cpu_seconds_than_real_seconds_">Why
+ does run_timer sometimes report more cpu seconds than real seconds?</a>
+ </h4>
+<p>
+ Ask your operating system supplier. The results have been inspected with
+ a debugger, and both for Windows and Linux, that's what the OS appears to
+ be reporting at times.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="rationale.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../appendices.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="acknowledgements.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/rationale.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/rationale.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,62 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title> Appendix B: Rationale</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../../index.html" title="Boost.Chrono">
+<link rel="up" href="../appendices.html" title="Appendices">
+<link rel="prev" href="history.html" title=" Appendix A: History">
+<link rel="next" href="implementation.html" title=" Appendix C:
+ Implementation Notes">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="history.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../appendices.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="implementation.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_chrono.appendices.rationale"></a> Appendix B: Rationale
+</h3></div></div></div>
+<p>
+ See [http://www.open-std.org/jtc1/sc22/wg21 <span class="bold"><strong>N2661 -
+ A Foundation to Sleep On</strong></span>] which is very informative and provides
+ motivation for key design decisions. The following sections are an extract
+ from this document.
+ </p>
+<a name="boost_chrono.appendices.rationale.is_it_possible_for_the_user_to_pass_a__code__phrase_role__identifier__duration__phrase___code__to_a_function_with_the_units_being_ambiguous_"></a><h4>
+<a name="id4853388"></a>
+ <a href="rationale.html#boost_chrono.appendices.rationale.is_it_possible_for_the_user_to_pass_a__code__phrase_role__identifier__duration__phrase___code__to_a_function_with_the_units_being_ambiguous_">Is
+ it possible for the user to pass a <code class="computeroutput"><span class="identifier">duration</span></code>
+ to a function with the units being ambiguous?</a>
+ </h4>
+<p>
+ No. No matter which option the author of <code class="computeroutput"><span class="identifier">f</span></code>
+ chooses above, the following client code will not compile:
+ </p>
+<pre class="programlisting"><span class="identifier">f</span><span class="special">(</span><span class="number">3</span><span class="special">);</span> <span class="comment">// Will not compile, 3 is not implicitly convertible to any `duration`
+</span></pre>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="history.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../appendices.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="implementation.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/todo.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/todo.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,91 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title> Appendix F: Future plans</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../../index.html" title="Boost.Chrono">
+<link rel="up" href="../appendices.html" title="Appendices">
+<link rel="prev" href="appendix_f__tickets.html" title="Appendix
+ F: Tickets">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="appendix_f__tickets.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../appendices.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_chrono.appendices.todo"></a> Appendix F: Future plans
+</h3></div></div></div>
+<a name="boost_chrono.appendices.todo.tasks_to_do_before_review"></a><h4>
+<a name="id4854159"></a>
+ <a href="todo.html#boost_chrono.appendices.todo.tasks_to_do_before_review">Tasks
+ to do before review</a>
+ </h4>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ Fully implement error handling, with test cases.
+ </li>
+<li>
+ Consider issues raised by Michael Marcin:
+ </li>
+</ul></div>
+<p>
+ &gt; In the past I've seen QueryPerformanceCounter give incorrect results,
+ &gt; especially with SpeedStep processors on laptops. This was many years ago and
+ &gt; might have been fixed by service packs and drivers.
+ &gt;
+ &gt; Typically you check the results of QPC against GetTickCount to see if the
+ &gt; results are reasonable.
+ &gt; http://support.microsoft.com/kb/274323
+ &gt;
+ &gt; I've also heard of problems with QueryPerformanceCounter in multi-processor
+ &gt; systems.
+ &gt;
+ &gt; I know some people SetThreadAffinityMask to 1 for the current thread call
+ &gt; their QueryPerformance* functions then restore SetThreadAffinityMask. This
+ &gt; seems horrible to me because it forces your program to jump to another
+ &gt; physical processor if it isn't already on cpu0 but they claim it worked well
+ &gt; in practice because they called the timing functions infrequently.
+ &gt;
+ &gt; In the past I have chosen to use timeGetTime with timeBeginPeriod(1) for
+ &gt; high resolution timers to avoid these issues.
+ </p>
+<a name="boost_chrono.appendices.todo.for_later_releases"></a><h4>
+<a name="id4854218"></a>
+ <a href="todo.html#boost_chrono.appendices.todo.for_later_releases">For later
+ releases</a>
+ </h4>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ Use of C++0x features, such as variadic templates, rvalues, decltype and
+ constexpr, when available.
+ </li>
+<li>
+ Define a C++98 variadic template emmulation of common_type
+ </li>
+</ul></div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="appendix_f__tickets.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../appendices.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,61 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Examples</title>
+<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../index.html" title="Boost.Chrono">
+<link rel="up" href="../index.html" title="Boost.Chrono">
+<link rel="prev" href="reference/process_times_hpp.html" title=" Header &lt;boost/chrono/process_times.hpp&gt;">
+<link rel="next" href="examples/si_units.html" title="SI-units">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="reference/process_times_hpp.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="examples/si_units.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_chrono.examples"></a>Examples
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">SI-units</span></dt>
+<dt><span class="section"><a href="examples/how_you_override_the_duration_s_default_constructor.html">How
+ you override the duration's default constructor</a></span></dt>
+<dt><span class="section">min utility</span></dt>
+<dt><span class="section">Cycle count</span></dt>
+<dt><span class="section">xtime_clock</span></dt>
+<dt><span class="section">runtime_resolution</span></dt>
+<dt><span class="section"><a href="examples/simulated_thread_interface_demonstration_program.html">Simulated
+ thread interface demonstration program</a></span></dt>
+<dt><span class="section">saturating</span></dt>
+<dt><span class="section"><a href="examples/howard_hinnant_s_original_demonstration_program.html">Howard
+ Hinnant's original demonstration program</a></span></dt>
+<dt><span class="section"><a href="examples/a_tiny_program_that_times_how_long_until_a_key_is_struck.html">A
+ tiny program that times how long until a key is struck</a></span></dt>
+<dt><span class="section">run_timer_example.cpp</span></dt>
+<dt><span class="section">run_timer_example2.cpp</span></dt>
+</dl></div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="reference/process_times_hpp.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="examples/si_units.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/a_tiny_program_that_times_how_long_until_a_key_is_struck.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/a_tiny_program_that_times_how_long_until_a_key_is_struck.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,45 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>A
+ tiny program that times how long until a key is struck</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../../index.html" title="Boost.Chrono">
+<link rel="up" href="../examples.html" title="Examples">
+<link rel="prev" href="howard_hinnant_s_original_demonstration_program.html" title="Howard
+ Hinnant's original demonstration program">
+<link rel="next" href="run_timer_example_cpp.html" title="run_timer_example.cpp">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="howard_hinnant_s_original_demonstration_program.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="run_timer_example_cpp.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title">
+<a name="boost_chrono.examples.a_tiny_program_that_times_how_long_until_a_key_is_struck"></a><a href="a_tiny_program_that_times_how_long_until_a_key_is_struck.html" title="A
+ tiny program that times how long until a key is struck">A
+ tiny program that times how long until a key is struck</a>
+</h3></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="howard_hinnant_s_original_demonstration_program.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="run_timer_example_cpp.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/howard_hinnant_s_original_demonstration_program.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/howard_hinnant_s_original_demonstration_program.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,45 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Howard
+ Hinnant's original demonstration program</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../../index.html" title="Boost.Chrono">
+<link rel="up" href="../examples.html" title="Examples">
+<link rel="prev" href="saturating.html" title="saturating">
+<link rel="next" href="a_tiny_program_that_times_how_long_until_a_key_is_struck.html" title="A
+ tiny program that times how long until a key is struck">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="saturating.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="a_tiny_program_that_times_how_long_until_a_key_is_struck.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title">
+<a name="boost_chrono.examples.howard_hinnant_s_original_demonstration_program"></a><a href="howard_hinnant_s_original_demonstration_program.html" title="Howard
+ Hinnant's original demonstration program">Howard
+ Hinnant's original demonstration program</a>
+</h3></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="saturating.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="a_tiny_program_that_times_how_long_until_a_key_is_struck.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/howard_hinnant_s_simulated_thread_interface_demonstration_program.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/howard_hinnant_s_simulated_thread_interface_demonstration_program.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,45 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Howard
+ Hinnant's simulated thread interface demonstration program</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../../index.html" title="Boost.Chrono">
+<link rel="up" href="../examples.html" title="Examples">
+<link rel="prev" href="howard_hinnant_s_original_demonstration_program.html" title="Howard
+ Hinnant's original demonstration program">
+<link rel="next" href="si_units.html" title="SI-units">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="howard_hinnant_s_original_demonstration_program.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="si_units.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title">
+<a name="boost_chrono.examples.howard_hinnant_s_simulated_thread_interface_demonstration_program"></a><a href="howard_hinnant_s_simulated_thread_interface_demonstration_program.html" title="Howard
+ Hinnant's simulated thread interface demonstration program">Howard
+ Hinnant's simulated thread interface demonstration program</a>
+</h3></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="howard_hinnant_s_original_demonstration_program.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="si_units.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/run_timer_example2_cpp.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/run_timer_example2_cpp.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,78 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>run_timer_example2.cpp</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../../index.html" title="Boost.Chrono">
+<link rel="up" href="../examples.html" title="Examples">
+<link rel="prev" href="run_timer_example_cpp.html" title="run_timer_example.cpp">
+<link rel="next" href="../appendices.html" title="Appendices">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="run_timer_example_cpp.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../appendices.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_chrono.examples.run_timer_example2_cpp"></a>run_timer_example2.cpp
+</h3></div></div></div>
+<p>
+ The run_timer_example2.cpp program is the same, except that it supplies additional
+ constructor arguments from the command line:
+ </p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">system</span><span class="special">/</span><span class="identifier">timer</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">cmath</span><span class="special">&gt;</span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">(</span> <span class="keyword">int</span> <span class="identifier">argc</span><span class="special">,</span> <span class="keyword">char</span> <span class="special">*</span> <span class="identifier">argv</span><span class="special">[]</span> <span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span> <span class="identifier">format</span> <span class="special">=</span> <span class="identifier">argc</span> <span class="special">&gt;</span> <span class="number">1</span> <span class="special">?</span> <span class="identifier">argv</span><span class="special">[</span><span class="number">1</span><span class="special">]</span> <span class="special">:</span> <span class="string">"%t cpu seconds\n"</span><span class="special">;</span>
+ <span class="keyword">int</span> <span class="identifier">places</span> <span class="special">=</span> <span class="identifier">argc</span> <span class="special">&gt;</span> <span class="number">2</span> <span class="special">?</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">atoi</span><span class="special">(</span> <span class="identifier">argv</span><span class="special">[</span><span class="number">2</span><span class="special">]</span> <span class="special">)</span> <span class="special">:</span> <span class="number">2</span><span class="special">;</span>
+
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">system</span><span class="special">::</span><span class="identifier">run_timer</span> <span class="identifier">t</span><span class="special">(</span> <span class="identifier">format</span><span class="special">,</span> <span class="identifier">places</span> <span class="special">);</span>
+
+ <span class="keyword">for</span> <span class="special">(</span> <span class="keyword">long</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special">&lt;</span> <span class="number">10000000</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span> <span class="special">)</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">sqrt</span><span class="special">(</span> <span class="number">123.456L</span> <span class="special">);</span> <span class="comment">// burn some time
+</span>
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ Here is the output for this program for several sets of command line arguments:
+ </p>
+<pre class="programlisting"><span class="identifier">run_timer_example2</span>
+<span class="number">0.42</span> <span class="identifier">cpu</span> <span class="identifier">seconds</span>
+
+<span class="identifier">run_timer_example2</span> <span class="string">"%w wall clock seconds\n"</span>
+<span class="number">0.41</span> <span class="identifier">wall</span> <span class="identifier">clock</span> <span class="identifier">seconds</span>
+
+<span class="identifier">run_timer_example2</span> <span class="string">"%w wall clock seconds\n"</span> <span class="number">6</span>
+<span class="number">0.421875</span> <span class="identifier">wall</span> <span class="identifier">clock</span> <span class="identifier">seconds</span>
+
+<span class="identifier">run_timer_example2</span> <span class="string">"%t total CPU seconds\n"</span> <span class="number">3</span>
+<span class="number">0.422</span> <span class="identifier">total</span> <span class="identifier">CPU</span> <span class="identifier">seconds</span>
+</pre>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="run_timer_example_cpp.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../appendices.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/run_timer_example_cpp.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/run_timer_example_cpp.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,64 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>run_timer_example.cpp</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../../index.html" title="Boost.Chrono">
+<link rel="up" href="../examples.html" title="Examples">
+<link rel="prev" href="a_tiny_program_that_times_how_long_until_a_key_is_struck.html" title="A
+ tiny program that times how long until a key is struck">
+<link rel="next" href="run_timer_example2_cpp.html" title="run_timer_example2.cpp">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="a_tiny_program_that_times_how_long_until_a_key_is_struck.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="run_timer_example2_cpp.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_chrono.examples.run_timer_example_cpp"></a>run_timer_example.cpp
+</h3></div></div></div>
+<p>
+ Here is the run_timer_example.cpp program supplied with the Boost Chrono
+ library:
+ </p>
+<p>
+ When the run_timer t object is created, it starts timing. When it is destroyed
+ at the end of the program, its destructor stops the timer and displays timing
+ information on cout.
+ </p>
+<p>
+ The output of this program run on a circa 2006 processor looks was this:
+ </p>
+<pre class="programlisting"><span class="identifier">wall</span> <span class="number">0.42</span> <span class="identifier">s</span><span class="special">,</span> <span class="identifier">user</span> <span class="number">0.41</span> <span class="identifier">s</span> <span class="special">+</span> <span class="identifier">system</span> <span class="number">0.00</span> <span class="identifier">s</span> <span class="special">=</span> <span class="identifier">total</span> <span class="identifier">cpu</span> <span class="number">0.41</span> <span class="identifier">s</span><span class="special">,</span> <span class="special">(</span><span class="number">96.3</span><span class="special">%)</span>
+</pre>
+<p>
+ In other words, this program ran in 0.42 seconds as would be measured by
+ a clock on the wall, the operating system charged it for 0.41 seconds of
+ user CPU time and 0 seconds of system CPU time, the total of these two was
+ 0.41, and that represented 96.3 percent of the wall clock time.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="a_tiny_program_that_times_how_long_until_a_key_is_struck.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="run_timer_example2_cpp.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/saturating.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/saturating.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,51 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>saturating</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../../index.html" title="Boost.Chrono">
+<link rel="up" href="../examples.html" title="Examples">
+<link rel="prev" href="simulated_thread_interface_demonstration_program.html" title="Simulated
+ thread interface demonstration program">
+<link rel="next" href="howard_hinnant_s_original_demonstration_program.html" title="Howard
+ Hinnant's original demonstration program">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="simulated_thread_interface_demonstration_program.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="howard_hinnant_s_original_demonstration_program.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_chrono.examples.saturating"></a>saturating
+</h3></div></div></div>
+<p>
+ A "saturating" signed integral type is developed. This type has
+ +/- infinity and a nan (like IEEE floating point) but otherwise obeys signed
+ integral arithmetic. This class is subsequently used as the rep in boost::chrono::duration
+ to demonstrate a duration class that does not silently ignore overflow.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="simulated_thread_interface_demonstration_program.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="howard_hinnant_s_original_demonstration_program.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/si_units.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/si_units.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,48 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>SI-units</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../../index.html" title="Boost.Chrono">
+<link rel="up" href="../examples.html" title="Examples">
+<link rel="prev" href="../examples.html" title="Examples">
+<link rel="next" href="how_you_override_the_duration_s_default_constructor.html" title="How
+ you override the duration's default constructor">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../examples.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="how_you_override_the_duration_s_default_constructor.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_chrono.examples.si_units"></a>SI-units
+</h3></div></div></div>
+<p>
+ Type-safe "physics" code interoperating with std::chrono::duration
+ types and taking advantage of the std::ratio infrastructure and design philosophy.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../examples.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="how_you_override_the_duration_s_default_constructor.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/overview.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/overview.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,174 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Overview</title>
+<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../index.html" title="Boost.Chrono">
+<link rel="up" href="../index.html" title="Boost.Chrono">
+<link rel="prev" href="../index.html" title="Boost.Chrono">
+<link rel="next" href="overview/motivation.html" title="Motivation">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../index.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="overview/motivation.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_chrono.overview"></a>Overview
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Motivation</span></dt>
+<dd><dl>
+<dt><span class="section"><a href="overview/motivation.html#boost_chrono.overview.motivation.common_type">Common
+ type</a></span></dt>
+<dt><span class="section">Ratio</span></dt>
+<dt><span class="section">Duration</span></dt>
+<dt><span class="section">Clocks</span></dt>
+<dt><span class="section">Time Point</span></dt>
+<dt><span class="section">Timers</span></dt>
+</dl></dd>
+</dl></div>
+<a name="boost_chrono.overview.description"></a><h3>
+<a name="id4762284"></a>
+ Description
+ </h3>
+<p>
+ The Boost Chrono library provides:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ The C++0x Standard Library's <code class="computeroutput"><span class="identifier">common_type</span></code>.
+ </li>
+<li>
+ The C++0x Standard Library's compile-time rational arithmetic.
+ </li>
+<li>
+ The C++0x Standard Library's time utilities, including:
+ <div class="itemizedlist"><ul type="circle">
+<li>
+ Class template <code class="computeroutput"><span class="identifier">duration</span></code>
+</li>
+<li>
+ Class template <code class="computeroutput"><span class="identifier">time_point</span></code>
+</li>
+<li>
+ Clocks:
+ <div class="itemizedlist"><ul type="square">
+<li><code class="computeroutput"><span class="identifier">system_clock</span></code></li>
+<li><code class="computeroutput"><span class="identifier">monotonic_clock</span></code></li>
+<li><code class="computeroutput"><span class="identifier">high_resolution_clock</span></code></li>
+</ul></div>
+</li>
+</ul></div>
+</li>
+<li>
+ Class template timer, with typedefs:
+ <div class="itemizedlist"><ul type="circle">
+<li><code class="computeroutput"><span class="identifier">system_timer</span></code></li>
+<li><code class="computeroutput"><span class="identifier">monotonic_timer</span></code></li>
+<li><code class="computeroutput"><span class="identifier">high_resolution_timer</span></code></li>
+</ul></div>
+</li>
+<li>
+ Process clocks and timers:
+ <div class="itemizedlist"><ul type="circle">
+<li>
+<code class="computeroutput"><span class="identifier">process_clock</span></code>, capturing
+ real, user-CPU, and system-CPU times.
+ </li>
+<li>
+<code class="computeroutput"><span class="identifier">process_timer</span></code>, capturing
+ elapsed real, user-CPU, and system-CPU times.
+ </li>
+<li>
+<code class="computeroutput"><span class="identifier">run_timer</span></code>, convenient
+ reporting of process_timer results.
+ </li>
+</ul></div>
+</li>
+</ul></div>
+<a name="boost_chrono.overview.how_to_use_this_documentation"></a><h3>
+<a name="id4764874"></a>
+ <a href="overview.html#boost_chrono.overview.how_to_use_this_documentation">How to
+ Use This Documentation</a>
+ </h3>
+<p>
+ This documentation makes use of the following naming and formatting conventions.
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ Code is in <code class="computeroutput"><span class="identifier">fixed</span> <span class="identifier">width</span>
+ <span class="identifier">font</span></code> and is syntax-highlighted.
+ </li>
+<li>
+ Replaceable text that you will need to supply is in
+ <em class="replaceable"><code>
+ italics
+ </code></em>
+ .
+ </li>
+<li>
+ If a name refers to a free function, it is specified like this: <code class="computeroutput"><span class="identifier">free_function</span><span class="special">()</span></code>;
+ that is, it is in code font and its name is followed by <code class="computeroutput"><span class="special">()</span></code>
+ to indicate that it is a free function.
+ </li>
+<li>
+ If a name refers to a class template, it is specified like this: <code class="computeroutput"><span class="identifier">class_template</span><span class="special">&lt;&gt;</span></code>;
+ that is, it is in code font and its name is followed by <code class="computeroutput"><span class="special">&lt;&gt;</span></code>
+ to indicate that it is a class template.
+ </li>
+<li>
+ If a name refers to a function-like macro, it is specified like this: <code class="computeroutput"><span class="identifier">MACRO</span><span class="special">()</span></code>;
+ that is, it is uppercase in code font and its name is followed by <code class="computeroutput"><span class="special">()</span></code> to indicate that it is a function-like
+ macro. Object-like macros appear without the trailing <code class="computeroutput"><span class="special">()</span></code>.
+ </li>
+<li>
+ Names that refer to <span class="emphasis"><em>concepts</em></span> in the generic programming
+ sense are specified in CamelCase.
+ </li>
+</ul></div>
+<div class="note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../doc/html/images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ In addition, notes such as this one specify non-essential information that
+ provides additional background or rationale.
+ </p></td></tr>
+</table></div>
+<p>
+ Finally, you can mentally add the following to any code fragments in this document:
+ </p>
+<pre class="programlisting"><span class="comment">// Include all of Chono files
+</span><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">chono</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">ratio</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">/</span><span class="identifier">common_type</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">chono</span><span class="special">/</span><span class="identifier">timer</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">chono</span><span class="special">/</span><span class="identifier">process_times</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+</pre>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../index.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="overview/motivation.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/overview/motivation.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/overview/motivation.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,715 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Motivation</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../../index.html" title="Boost.Chrono">
+<link rel="up" href="../overview.html" title="Overview">
+<link rel="prev" href="../overview.html" title="Overview">
+<link rel="next" href="../users_guide.html" title=" Users'Guide">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../overview.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../users_guide.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_chrono.overview.motivation"></a>Motivation
+</h3></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="motivation.html#boost_chrono.overview.motivation.common_type">Common
+ type</a></span></dt>
+<dt><span class="section">Ratio</span></dt>
+<dt><span class="section">Duration</span></dt>
+<dt><span class="section">Clocks</span></dt>
+<dt><span class="section">Time Point</span></dt>
+<dt><span class="section">Timers</span></dt>
+</dl></div>
+<p>
+ See <a href="http://www.open-std.org/jtc1/sc22/wg21" target="_top"><span class="bold"><strong>N2661
+ - A Foundation to Sleep On</strong></span></a> which is very informative and
+ provides motivation for key design decisions for <code class="computeroutput"><span class="identifier">common_type</span></code>,
+ <code class="computeroutput"><span class="identifier">ratio</span></code> and <code class="computeroutput"><span class="identifier">chrono</span></code>.
+ The following sections are an extract from this document.
+ </p>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.overview.motivation.common_type"></a><a href="motivation.html#boost_chrono.overview.motivation.common_type" title="Common
+ type">Common
+ type</a>
+</h4></div></div></div>
+<p>
+ <code class="computeroutput"><span class="identifier">common_type</span></code> has been a
+ recurring theme in many places for many years. We've previously known it
+ as promote and examples of it are spread throughout boost. It has been
+ reinvented independently several times, because it is so useful.
+ </p>
+<p>
+ Andrei Alexandrescu recently pointed us at a D library: std.traits - D
+ Programming Language - Digital Mars, which became the motivation for this
+ particular name, and the variadic nature of this trait.
+ </p>
+<p>
+ In a nutshell, <code class="computeroutput"><span class="identifier">common_type</span></code>
+ is a trait that takes 1 or more types, and returns a type which all of
+ the types will convert to. The default definition demands this conversion
+ be implicit. However the trait can be specialized for user-defined types
+ which want to limit their inter-type conversions to explicit, and yet still
+ want to interoperate with the <code class="computeroutput"><span class="identifier">common_type</span></code>
+ facility.
+ </p>
+<p>
+ <span class="bold"><strong>Example:</strong></span>
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U</span><span class="special">&gt;</span>
+<span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">complex</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;,</span> <span class="identifier">complex</span><span class="special">&lt;</span><span class="identifier">U</span><span class="special">&gt;</span> <span class="special">&gt;::</span><span class="identifier">type</span>
+<span class="keyword">operator</span><span class="special">+(</span><span class="identifier">complex</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;,</span> <span class="identifier">complex</span><span class="special">&lt;</span><span class="identifier">U</span><span class="special">&gt;);</span>
+</pre>
+<p>
+ In the above example, "mixed-mode" complex arithmetic is allowed.
+ The return type is described by <code class="computeroutput"><span class="identifier">common_type</span></code>.
+ For example the resulting type of adding a <code class="computeroutput"><span class="identifier">complex</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;</span></code> and <code class="computeroutput"><span class="identifier">complex</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span></code> might be a <code class="computeroutput"><span class="identifier">complex</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span></code>. Another choice for the author might
+ be:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U</span><span class="special">&gt;</span>
+<span class="identifier">complex</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&gt;</span>
+<span class="keyword">operator</span><span class="special">+(</span><span class="identifier">complex</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;,</span> <span class="identifier">complex</span><span class="special">&lt;</span><span class="identifier">U</span><span class="special">&gt;);</span>
+</pre>
+<p>
+ Here is how someone might produce a variadic comparison function:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="special">...</span><span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">...&gt;::</span><span class="identifier">type</span>
+<span class="identifier">min</span><span class="special">(</span><span class="identifier">T</span><span class="special">...</span> <span class="identifier">t</span><span class="special">);</span>
+</pre>
+<p>
+ This is a very useful and broadly applicable utility. The <code class="computeroutput"><span class="identifier">duration</span></code> and <code class="computeroutput"><span class="identifier">time_point</span></code>
+ facilities use it to make multi-precision arithmetic seamless and exact.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.overview.motivation.ratio"></a>Ratio
+</h4></div></div></div>
+<p>
+ <code class="computeroutput"><span class="identifier">ratio</span></code> is a general purpose
+ utility inspired by Walter Brown allowing one to easily and safely compute
+ rational values at compile time. The <code class="computeroutput"><span class="identifier">ratio</span></code>
+ class catches all errors (such as divide by zero and overflow) at compile
+ time. It is used in the <code class="computeroutput"><span class="identifier">duration</span></code>
+ and <code class="computeroutput"><span class="identifier">time_point</span></code> classes
+ to efficiently create units of time. It can also be used in other "quantity"
+ libraries (both std-defined and user-defined), or anywhere there is a rational
+ constant which is known at compile time. The use of this utility can greatly
+ reduce the chances of run time overflow because the <code class="computeroutput"><span class="identifier">ratio</span></code>
+ (and any ratios resulting from <code class="computeroutput"><span class="identifier">ratio</span></code>
+ arithmetic) are always reduced to lowest terms.
+ </p>
+<p>
+ <code class="computeroutput"><span class="identifier">ratio</span></code> is a template taking
+ two intmax_ts, with the second defaulted to 1. It only has two public members,
+ both of which are static const intmax_t. One is the numerator of the <code class="computeroutput"><span class="identifier">ratio</span></code> and the other is the denominator.
+ The <code class="computeroutput"><span class="identifier">ratio</span></code> is always normalized
+ such that it is expressed in lowest terms, and the denominator is always
+ positive. When the numerator is 0, the denominator is always 1.
+ </p>
+<p>
+ <span class="bold"><strong>Example:</strong></span>
+ </p>
+<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">5</span><span class="special">,</span> <span class="number">3</span><span class="special">&gt;</span> <span class="identifier">five_thirds</span><span class="special">;</span> <span class="comment">// five_thirds::num == 5, five_thirds::den == 3
+</span><span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">25</span><span class="special">,</span> <span class="number">15</span><span class="special">&gt;</span> <span class="identifier">also_five_thirds</span><span class="special">;</span> <span class="comment">// also_five_thirds::num == 5, also_five_thirds::den == 3
+</span><span class="keyword">typedef</span> <span class="identifier">ratio_divide</span><span class="special">&lt;</span><span class="identifier">five_thirds</span><span class="special">,</span> <span class="identifier">also_five_thirds</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">one</span><span class="special">;</span> <span class="comment">// one::num == 1, one::den == 1
+</span></pre>
+<p>
+ This facility also includes convenience typedefs for the SI prefixes atto
+ through exa corresponding to their internationally recognized definitions
+ (in terms of <code class="computeroutput"><span class="identifier">ratio</span></code>). This
+ is a tremendous syntactic convenience. It will prevent errors in specifying
+ constants as one no longer has to double count the number of zeros when
+ trying to write million or billion.
+ </p>
+<p>
+ <span class="bold"><strong>Example:</strong></span>
+ </p>
+<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">ratio_multiply</span><span class="special">&lt;</span><span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">5</span><span class="special">&gt;,</span> <span class="identifier">giga</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">_5giga</span><span class="special">;</span> <span class="comment">// _5giga::num == 5000000000, _5giga::den == 1
+</span><span class="keyword">typedef</span> <span class="identifier">ratio_multiply</span><span class="special">&lt;</span><span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">5</span><span class="special">&gt;,</span> <span class="identifier">nano</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">_5nano</span><span class="special">;</span> <span class="comment">// _5nano::num == 1, _5nano::den == 200000000
+</span></pre>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.overview.motivation.duration"></a>Duration
+</h4></div></div></div>
+<p>
+ The <code class="computeroutput"><span class="identifier">duration</span></code> is the heart
+ of this library. The interface that the user will see in everyday use is
+ nearly identical to that of Boost.DateTime time <code class="computeroutput"><span class="identifier">duration</span></code>s
+ authored by Jeff Garland, both in syntax and in behavior. This has been
+ a very popular boost library for 7 years. There is an enormous positive
+ history with this interface.
+ </p>
+<p>
+ The library consists of six units of time <code class="computeroutput"><span class="identifier">duration</span></code>:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ hours
+ </li>
+<li>
+ minutes
+ </li>
+<li>
+ seconds
+ </li>
+<li>
+ milliseconds
+ </li>
+<li>
+ microseconds
+ </li>
+<li>
+ nanoseconds
+ </li>
+</ul></div>
+<p>
+ These units were chosen as a subset of the boost library because they are
+ the most common units used when sleeping, waiting on a condition variable,
+ or waiting to obtain the lock on a mutex. Each of these units is nothing
+ but a thin wrapper around a signed integral count. That is, when you construct
+ <code class="computeroutput"><span class="identifier">minutes</span><span class="special">(</span><span class="number">3</span><span class="special">)</span></code>, all that
+ happens is a 3 is stored inside of minutes. When you construct <code class="computeroutput"><span class="identifier">microseconds</span><span class="special">(</span><span class="number">3</span><span class="special">)</span></code>, all that
+ happens is a 3 is stored inside of microseconds.
+ </p>
+<p>
+ The only context in which these different types differ is when being converted
+ to one another. At this time, unit-specific compile-time conversion constants
+ are used to convert the source unit to the target unit. Only conversions
+ from coarser units to finer units are allowed (in boost). This restriction
+ ensures that all conversions are always exact. That is, microseconds can
+ always represent any value minutes has.
+ </p>
+<p>
+ In Boost.DateTime, these units are united via inheritance. Boost.Chrono
+ instead unites these units through the class template <code class="computeroutput"><span class="identifier">duration</span></code>.
+ That is, in Boost.Chrono all six of the above units are nothing but typedefs
+ to different instantiations of <code class="computeroutput"><span class="identifier">duration</span></code>.
+ This change from Boost.DateTime has a far reaching positive impact, while
+ not changing the syntax of the everyday use at all.
+ </p>
+<p>
+ The most immediate positive impact is that the library can immediately
+ generate any unit, any precision it needs. This is sometimes necessary
+ when doing comparisons or arithmetic between <code class="computeroutput"><span class="identifier">duration</span></code>s
+ of differing precision, assuming one wants the comparison and arithmetic
+ to be exactly correct.
+ </p>
+<p>
+ A secondary benefit is that by publishing the class template <code class="computeroutput"><span class="identifier">duration</span></code> interface, user code can very
+ easily create <code class="computeroutput"><span class="identifier">duration</span></code>s
+ with any precision they desire. The <code class="computeroutput"><span class="identifier">ratio</span></code>
+ utility is used to specify the precision, so as long as the precision can
+ be expressed by a rational constant with respect to seconds, this framework
+ can exactly represent it (one third of a second is no problem, and neither
+ is one third of a femto second). All of this utility and flexibility comes
+ at no cost just by making use of the no-run-time-overhead <code class="computeroutput"><span class="identifier">ratio</span></code> facility.
+ </p>
+<p>
+ In Boost.DateTime, hours does not have the same representation as nanoseconds.
+ The former is usually represented with a long whereas a long long is required
+ for the latter. The reason for this is simply range. You don't need many
+ hours to cover an extremely large range of time. But this isn't true of
+ nanoseconds. Being able to reduce the sizeof overhead for some units when
+ possible, can be a significant performance advantage.
+ </p>
+<p>
+ Boost.Chrono continues, and generalizes that philosophy. Not only can one
+ specify the precision of a <code class="computeroutput"><span class="identifier">duration</span></code>,
+ one can also specify its representation. This can be any integral type,
+ or even a floating point type. Or it can be a user-defined type which emulates
+ an arithmetic type. The six predefined units all use signed integral types
+ as their representation. And they all have a minimum range of +/- 292 years.
+ nanoseconds needs 64 bits to cover that range. hours needs only 23 bits
+ to cover that range.
+ </p>
+<a name="boost_chrono.overview.motivation.duration.so_what_exactly_is_a__code__phrase_role__identifier__duration__phrase___code__and_how_do_i_use_one_"></a><h5>
+<a name="id4759304"></a>
+ <a href="motivation.html#boost_chrono.overview.motivation.duration.so_what_exactly_is_a__code__phrase_role__identifier__duration__phrase___code__and_how_do_i_use_one_">So
+ What Exactly is a <code class="computeroutput"><span class="identifier">duration</span></code>
+ and How Do I Use One?</a>
+ </h5>
+<p>
+ A <code class="computeroutput"><span class="identifier">duration</span></code> has a representation
+ and a tick period (precision).
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period</span> <span class="special">=</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">1</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="keyword">class</span> <span class="identifier">duration</span><span class="special">;</span>
+</pre>
+<p>
+ The representation is simply any arithmetic type, or an emulation of such
+ a type. The representation stores a count of ticks. This count is the only
+ data member stored in a <code class="computeroutput"><span class="identifier">duration</span></code>.
+ If the representation is floating point, it can store fractions of a tick
+ to the precision of the representation. The tick period is represented
+ by a <code class="computeroutput"><span class="identifier">ratio</span></code> and is encoded
+ into the <code class="computeroutput"><span class="identifier">duration</span></code>'s type,
+ instead of stored. The tick period only has an impact on the behavior of
+ the <code class="computeroutput"><span class="identifier">duration</span></code> when a conversion
+ between different <code class="computeroutput"><span class="identifier">duration</span></code>'s
+ is attempted. The tick period is completely ignored when simply doing arithmetic
+ among like <code class="computeroutput"><span class="identifier">duration</span></code>s.
+ </p>
+<p>
+ <span class="bold"><strong>Example:</strong></span>
+ </p>
+<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="keyword">long</span><span class="special">,</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">60</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">minutes</span><span class="special">;</span>
+<span class="identifier">minutes</span> <span class="identifier">m1</span><span class="special">(</span><span class="number">3</span><span class="special">);</span> <span class="comment">// m1 stores 3
+</span><span class="identifier">minutes</span> <span class="identifier">m2</span><span class="special">(</span><span class="number">2</span><span class="special">);</span> <span class="comment">// m2 stores 2
+</span><span class="identifier">minutes</span> <span class="identifier">m3</span> <span class="special">=</span> <span class="identifier">m1</span> <span class="special">+</span> <span class="identifier">m2</span><span class="special">;</span> <span class="comment">// m3 stores 5
+</span>
+<span class="keyword">typedef</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="keyword">long</span> <span class="keyword">long</span><span class="special">,</span> <span class="identifier">micro</span><span class="special">&gt;</span> <span class="identifier">microseconds</span><span class="special">;</span>
+<span class="identifier">microseconds</span> <span class="identifier">us1</span><span class="special">(</span><span class="number">3</span><span class="special">);</span> <span class="comment">// us1 stores 3
+</span><span class="identifier">microseconds</span> <span class="identifier">us2</span><span class="special">(</span><span class="number">2</span><span class="special">);</span> <span class="comment">// us2 stores 2
+</span><span class="identifier">microseconds</span> <span class="identifier">us3</span> <span class="special">=</span> <span class="identifier">us1</span> <span class="special">+</span> <span class="identifier">us2</span><span class="special">;</span> <span class="comment">// us3 stores 5
+</span>
+<span class="identifier">microseconds</span> <span class="identifier">us4</span> <span class="special">=</span> <span class="identifier">m3</span> <span class="special">+</span> <span class="identifier">us3</span><span class="special">;</span> <span class="comment">// us4 stores 300000005
+</span></pre>
+<p>
+ In the final line of code above, there is an implicit conversion from minutes
+ to microseconds, resulting in a relatively large number of microseconds.
+ </p>
+<p>
+ If you need to access the tick count within a <code class="computeroutput"><span class="identifier">duration</span></code>,
+ there is a member <code class="computeroutput"><span class="identifier">count</span><span class="special">()</span></code> which simply returns the stored tick
+ count.
+ </p>
+<pre class="programlisting"><span class="keyword">long</span> <span class="keyword">long</span> <span class="identifier">tc</span> <span class="special">=</span> <span class="identifier">us4</span><span class="special">.</span><span class="identifier">count</span><span class="special">();</span> <span class="comment">// tc is 300000005
+</span></pre>
+<p>
+ These <code class="computeroutput"><span class="identifier">duration</span></code>s have very
+ simple, very predictable, and very observable behavior. After all, this
+ is really nothing but the time tested interface of Jeff's boost time <code class="computeroutput"><span class="identifier">duration</span></code> library (unified with templates
+ instead of inheritance).
+ </p>
+<a name="boost_chrono.overview.motivation.duration.what_happens_if_i_assign__code__phrase_role__identifier__m3__phrase___phrase_role__special_____phrase___phrase_role__identifier__us3__phrase___code__to_minutes_instead_of_microseconds_"></a><h5>
+<a name="id4758210"></a>
+ <a href="motivation.html#boost_chrono.overview.motivation.duration.what_happens_if_i_assign__code__phrase_role__identifier__m3__phrase___phrase_role__special_____phrase___phrase_role__identifier__us3__phrase___code__to_minutes_instead_of_microseconds_">What
+ happens if I assign <code class="computeroutput"><span class="identifier">m3</span> <span class="special">+</span> <span class="identifier">us3</span></code>
+ to minutes instead of microseconds?</a>
+ </h5>
+<pre class="programlisting"><span class="identifier">minutes</span> <span class="identifier">m4</span> <span class="special">=</span> <span class="identifier">m3</span> <span class="special">+</span> <span class="identifier">us3</span><span class="special">;</span>
+</pre>
+<p>
+ It won't compile. The rationale is that implicit truncation error should
+ not be allowed to happen. If this were to compile, then <code class="computeroutput"><span class="identifier">m4</span></code>
+ would hold <code class="computeroutput"><span class="number">5</span></code>, the same value
+ as <code class="computeroutput"><span class="identifier">m3</span></code>. The value associated
+ with <code class="computeroutput"><span class="identifier">us3</span></code> has been effectively
+ ignored. This is similar to the problem of assigning a double to an <code class="computeroutput"><span class="keyword">int</span></code>: the fractional part gets silently discarded.
+ </p>
+<a name="boost_chrono.overview.motivation.duration.but_what_if_the_truncation_behavior_is_what_i_want_to_do_"></a><h5>
+<a name="id4813041"></a>
+ <a href="motivation.html#boost_chrono.overview.motivation.duration.but_what_if_the_truncation_behavior_is_what_i_want_to_do_">But
+ what if the truncation behavior is what I want to do?</a>
+ </h5>
+<p>
+ There is a <code class="computeroutput"><span class="identifier">duration_cast</span></code>
+ facility to explicitly ask for this behavior:
+ </p>
+<pre class="programlisting"><span class="identifier">minutes</span> <span class="identifier">m4</span> <span class="special">=</span> <span class="identifier">duration_cast</span><span class="special">&lt;</span><span class="identifier">minutes</span><span class="special">&gt;(</span><span class="identifier">m3</span> <span class="special">+</span> <span class="identifier">us3</span><span class="special">);</span> <span class="comment">// m4.count() == 5
+</span></pre>
+<p>
+ In general, one can perform <code class="computeroutput"><span class="identifier">duration</span></code>
+ arithmetic at will. If <code class="computeroutput"><span class="identifier">duration_cast</span></code>
+ isn't used, and it compiles, the arithmetic is exact. Any place one wants
+ to override this exact arithmetic behavior, duration_cast can be used to
+ explicitly specify that desire. The <code class="computeroutput"><span class="identifier">duration_cast</span></code>
+ has the same efficiency as the implicit conversion, and will even be exact
+ as often as it can.
+ </p>
+<a name="boost_chrono.overview.motivation.duration.i_m_trafficking_in_floating_point__code__phrase_role__identifier__duration__phrase___code_s__i_don_t_want_to_deal_with_writing__code__phrase_role__identifier__duration_cast__phrase___code__all_over_the_place__i_m_content_with_the_precision_of_my_floating_point_representation"></a><h5>
+<a name="id4813177"></a>
+ <a href="motivation.html#boost_chrono.overview.motivation.duration.i_m_trafficking_in_floating_point__code__phrase_role__identifier__duration__phrase___code_s__i_don_t_want_to_deal_with_writing__code__phrase_role__identifier__duration_cast__phrase___code__all_over_the_place__i_m_content_with_the_precision_of_my_floating_point_representation">I'm
+ trafficking in floating point <code class="computeroutput"><span class="identifier">duration</span></code>s.
+ I don't want to deal with writing <code class="computeroutput"><span class="identifier">duration_cast</span></code>
+ all over the place. I'm content with the precision of my floating point
+ representation</a>
+ </h5>
+<p>
+ Not a problem. When the destination of a conversion has floating point
+ representation, all conversions are allowed to happen implicitly.
+ </p>
+<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">,</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">60</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">dminutes</span><span class="special">;</span>
+<span class="identifier">dminutes</span> <span class="identifier">dm4</span> <span class="special">=</span> <span class="identifier">m3</span> <span class="special">+</span> <span class="identifier">us3</span><span class="special">;</span> <span class="comment">// dm4.count() == 5.000000083333333
+</span></pre>
+<a name="boost_chrono.overview.motivation.duration.how_expensive_is_all_of_this_"></a><h5>
+<a name="id4813340"></a>
+ <a href="motivation.html#boost_chrono.overview.motivation.duration.how_expensive_is_all_of_this_">How
+ expensive is all of this?</a>
+ </h5>
+<p>
+ If you were writing these conversions by hand, you could not make it more
+ efficient. The use of <code class="computeroutput"><span class="identifier">ratio</span></code>
+ ensures that all conversion constants are simplified as much as possible
+ at compile time. This usually results in the numerator or denominator of
+ the conversion factor simplifying to <code class="computeroutput"><span class="number">1</span></code>,
+ and being subsequently ignored in converting the run time values of the
+ tick counts.
+ </p>
+<a name="boost_chrono.overview.motivation.duration.how_complicated_is_it_to_build_a_function_taking_a__code__phrase_role__identifier__duration__phrase___code__parameter_"></a><h5>
+<a name="id4813390"></a>
+ <a href="motivation.html#boost_chrono.overview.motivation.duration.how_complicated_is_it_to_build_a_function_taking_a__code__phrase_role__identifier__duration__phrase___code__parameter_">How
+ complicated is it to build a function taking a <code class="computeroutput"><span class="identifier">duration</span></code>
+ parameter?</a>
+ </h5>
+<p>
+ There are several options open to the user:
+ </p>
+<div class="itemizedlist"><ul type="disc"><li>
+ If the author of the function wants to accept any <code class="computeroutput"><span class="identifier">duration</span></code>,
+ and is willing to work in floating point <code class="computeroutput"><span class="identifier">duration</span></code>s,
+ he can simply use any floating point <code class="computeroutput"><span class="identifier">duration</span></code>
+ as the parameter:
+ </li></ul></div>
+<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">duration</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span> <span class="identifier">d</span><span class="special">)</span> <span class="comment">// accept floating point seconds
+</span><span class="special">{</span>
+ <span class="comment">// d.count() == 3.e-6 when passed microseconds(3)
+</span><span class="special">}</span>
+
+<span class="identifier">f</span><span class="special">(</span><span class="identifier">microseconds</span><span class="special">(</span><span class="number">3</span><span class="special">));</span>
+</pre>
+<div class="itemizedlist"><ul type="disc"><li>
+ If the author of the function wants to traffic only in integral <code class="computeroutput"><span class="identifier">duration</span></code>s, and is content with handling
+ nothing finer than say nanoseconds (just as an example), he can simply
+ specify nanoseconds as the parameter:
+ </li></ul></div>
+<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">nanoseconds</span> <span class="identifier">d</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="comment">// d.count() == 3000 when passed microseconds(3)
+</span><span class="special">}</span>
+
+<span class="identifier">f</span><span class="special">(</span><span class="identifier">microseconds</span><span class="special">(</span><span class="number">3</span><span class="special">));</span>
+</pre>
+<p>
+ In this design, if the client wants to pass in a floating point <code class="computeroutput"><span class="identifier">duration</span></code>, or a <code class="computeroutput"><span class="identifier">duration</span></code>
+ of finer precision than nanoseconds, then the client is responsible for
+ choosing his own rounding mode in the conversion to nanoseconds.
+ </p>
+<pre class="programlisting"><span class="identifier">duration</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span> <span class="identifier">s</span><span class="special">(</span><span class="number">1.</span><span class="special">/</span><span class="number">3</span><span class="special">);</span> <span class="comment">// 1/3 of a second
+</span><span class="identifier">f</span><span class="special">(</span><span class="identifier">duration_cast</span><span class="special">&lt;</span><span class="identifier">nanoseconds</span><span class="special">&gt;(</span><span class="identifier">s</span><span class="special">));</span> <span class="comment">// round towards zero in conversion to nanoseconds
+</span></pre>
+<p>
+ In the example above, the client of f has chosen "round towards zero"
+ as the desired rounding mode to nanoseconds. If the client has a <code class="computeroutput"><span class="identifier">duration</span></code> that won't exactly convert to
+ nanoseconds, and fails to choose how the conversion will take place, the
+ compiler will refuse the call:
+ </p>
+<pre class="programlisting"><span class="identifier">f</span><span class="special">(</span><span class="identifier">s</span><span class="special">);</span> <span class="comment">// does not compile
+</span></pre>
+<div class="itemizedlist"><ul type="disc"><li>
+ If the author of the function wants to accept any <code class="computeroutput"><span class="identifier">duration</span></code>,
+ but wants to work with integral representations and wants to control
+ the rounding mode internally, then he can template the function:
+ </li></ul></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period</span><span class="special">&gt;</span>
+<span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep</span><span class="special">,</span> <span class="identifier">Period</span><span class="special">&gt;</span> <span class="identifier">d</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="comment">// convert d to nanoseconds, rounding up if it is not an exact conversion
+</span> <span class="identifier">nanoseconds</span> <span class="identifier">ns</span> <span class="special">=</span> <span class="identifier">duration_cast</span><span class="special">&lt;</span><span class="identifier">nanoseconds</span><span class="special">&gt;(</span><span class="identifier">d</span><span class="special">);</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">ns</span> <span class="special">&lt;</span> <span class="identifier">d</span><span class="special">)</span>
+ <span class="special">++</span><span class="identifier">ns</span><span class="special">;</span>
+ <span class="comment">// ns.count() == 333333334 when passed 1/3 of a floating point second
+</span><span class="special">}</span>
+
+<span class="identifier">f</span><span class="special">(</span><span class="identifier">duration</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;(</span><span class="number">1.</span><span class="special">/</span><span class="number">3</span><span class="special">));</span>
+</pre>
+<div class="itemizedlist"><ul type="disc"><li>
+ If the author in the example does not want to accept floating point based
+ <code class="computeroutput"><span class="identifier">duration</span></code>s, he can enforce
+ that behavior like so:
+ </li></ul></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Period</span><span class="special">&gt;</span>
+<span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">duration</span><span class="special">&lt;</span><span class="keyword">long</span> <span class="keyword">long</span><span class="special">,</span> <span class="identifier">Period</span><span class="special">&gt;</span> <span class="identifier">d</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="comment">// convert d to nanoseconds, rounding up if it is not an exact conversion
+</span> <span class="identifier">nanoseconds</span> <span class="identifier">ns</span> <span class="special">=</span> <span class="identifier">duration_cast</span><span class="special">&lt;</span><span class="identifier">nanoseconds</span><span class="special">&gt;(</span><span class="identifier">d</span><span class="special">);</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">ns</span> <span class="special">&lt;</span> <span class="identifier">d</span><span class="special">)</span>
+ <span class="special">++</span><span class="identifier">ns</span><span class="special">;</span>
+ <span class="comment">// ns.count() == 333333334 when passed 333333333333 picoseconds
+</span><span class="special">}</span>
+
+<span class="identifier">f</span><span class="special">(</span><span class="identifier">duration</span><span class="special">&lt;</span><span class="keyword">long</span> <span class="keyword">long</span><span class="special">,</span> <span class="identifier">pico</span><span class="special">&gt;(</span><span class="number">333333333333</span><span class="special">));</span> <span class="comment">// About 1/3 of a second worth of picoseconds
+</span></pre>
+<p>
+ Clients with floating point <code class="computeroutput"><span class="identifier">duration</span></code>s
+ who want to use f will now have to convert to an integral <code class="computeroutput"><span class="identifier">duration</span></code> themselves before passing the
+ result to f.
+ </p>
+<p>
+ In summary, the author of f has quite a bit of flexibility and control
+ in the interface he wants to provide his clients with, and easy options
+ for manipulating that <code class="computeroutput"><span class="identifier">duration</span></code>
+ internal to his function.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.overview.motivation.clocks"></a>Clocks
+</h4></div></div></div>
+<p>
+ While <code class="computeroutput"><span class="identifier">duration</span></code>s only have
+ precision and representation to concern themselves, clocks and <code class="computeroutput"><span class="identifier">time_point</span></code>s are intimately related and
+ refer to one another. Because clocks are simpler to explain, we will do
+ so first without fully explaining <code class="computeroutput"><span class="identifier">time_point</span></code>s.
+ Once clocks are introduced, it will be easier to then fill in what a <code class="computeroutput"><span class="identifier">time_point</span></code> is.
+ </p>
+<p>
+ A clock is a concept which bundles 3 things:
+ </p>
+<div class="orderedlist"><ol type="1">
+<li>
+ A concrete <code class="computeroutput"><span class="identifier">duration</span></code> type.
+ </li>
+<li>
+ A concrete <code class="computeroutput"><span class="identifier">time_point</span></code>
+ type.
+ </li>
+<li>
+ A function called now() which returns the concrete <code class="computeroutput"><span class="identifier">time_point</span></code>.
+ </li>
+</ol></div>
+<p>
+ Boost.Chrono proposes 3 concrete clocks:
+ </p>
+<div class="orderedlist"><ol type="1">
+<li>
+ system_clock
+ </li>
+<li>
+ monotonic_clock
+ </li>
+<li>
+ high_precision_clock
+ </li>
+</ol></div>
+<p>
+ A given platform may not be able to supply all three of these clocks. The
+ user is also able to easily create more clocks.
+ </p>
+<p>
+ Given a clock named Clock, it will have:
+ </p>
+<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">Clock</span> <span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="identifier">an</span> <span class="identifier">arithmetic</span><span class="special">-</span><span class="identifier">like</span> <span class="identifier">type</span> <span class="identifier">rep</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">an</span> <span class="identifier">instantiation</span> <span class="identifier">of</span> <span class="identifier">ratio</span> <span class="identifier">period</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">chrono</span><span class="special">::</span><span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">rep</span><span class="special">,</span> <span class="identifier">period</span><span class="special">&gt;</span> <span class="identifier">duration</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">chrono</span><span class="special">::</span><span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">&gt;</span> <span class="identifier">time_point</span><span class="special">;</span>
+ <span class="keyword">static</span> <span class="keyword">const</span> <span class="keyword">bool</span> <span class="identifier">is_monotonic</span> <span class="special">=</span> <span class="keyword">true</span> <span class="keyword">or</span> <span class="keyword">false</span><span class="special">;</span>
+
+ <span class="keyword">static</span> <span class="identifier">time_point</span> <span class="identifier">now</span><span class="special">();</span>
+<span class="special">};</span>
+</pre>
+<p>
+ One can get the current time from Clock with:
+ </p>
+<pre class="programlisting"><span class="identifier">Clock</span><span class="special">::</span><span class="identifier">time_point</span> <span class="identifier">t1</span> <span class="special">=</span> <span class="identifier">Clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">();</span>
+</pre>
+<p>
+ And one can get the time <code class="computeroutput"><span class="identifier">duration</span></code>
+ between two <code class="computeroutput"><span class="identifier">time_point</span></code>s
+ associated with Clock with:
+ </p>
+<pre class="programlisting"><span class="identifier">Clock</span><span class="special">::</span><span class="identifier">duration</span> <span class="identifier">d</span> <span class="special">=</span> <span class="identifier">t1</span> <span class="special">-</span> <span class="identifier">Clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">();</span>
+</pre>
+<p>
+ And one can specify a past or future <code class="computeroutput"><span class="identifier">time_point</span></code>
+ with:
+ </p>
+<pre class="programlisting"><span class="identifier">Clock</span><span class="special">::</span><span class="identifier">time_point</span> <span class="identifier">t2</span> <span class="special">=</span> <span class="identifier">Clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">d</span><span class="special">;</span>
+</pre>
+<p>
+ Note how even if a particular clock becomes obsolete, the next clock in
+ line will have the same API. There is no new learning curve to come up.
+ The only source code changes will be simply changing the type of the clock.
+ The same <code class="computeroutput"><span class="identifier">duration</span></code> and
+ <code class="computeroutput"><span class="identifier">time_point</span></code> framework continues
+ to work as new clocks are introduced. And multiple clocks are safely and
+ easily handled within the same program.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.overview.motivation.time_point"></a>Time Point
+</h4></div></div></div>
+<p>
+ A <code class="computeroutput"><span class="identifier">time_point</span></code> represents
+ a point in time, as opposed to a <code class="computeroutput"><span class="identifier">duration</span></code>
+ of time. Another way of saying the same thing, is that a <code class="computeroutput"><span class="identifier">time_point</span></code> represents an epoch plus or
+ minus a <code class="computeroutput"><span class="identifier">duration</span></code>. Examples
+ of <code class="computeroutput"><span class="identifier">time_point</span></code>s include:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ 3 minutes after the computer booted.
+ </li>
+<li>
+ 03:14:07 UTC on Tuesday, January 19, 2038
+ </li>
+<li>
+ 20 milliseconds after I started that timer.
+ </li>
+</ul></div>
+<p>
+ In each of the examples above, a different epoch is implied. Sometimes
+ an epoch has meaning for several millennia. Other times the meaning of
+ an epoch is lost after a while (such as the start of a timer, or when the
+ computer booted). However, if two <code class="computeroutput"><span class="identifier">time_point</span></code>s
+ are known to share the same epoch, they can be subtracted, yielding a valid
+ <code class="computeroutput"><span class="identifier">duration</span></code>, even if the definition
+ of the epoch no longer has meaning.
+ </p>
+<p>
+ In Boost.Chrono, an epoch is a purely abstract and unspecified concept.
+ There is no type representing an epoch. It is simply an idea that relates
+ (or doesn't) <code class="computeroutput"><span class="identifier">time_point</span></code>s
+ to a clock, and in the case that they share a clock, <code class="computeroutput"><span class="identifier">time_point</span></code>s
+ to one another. <code class="computeroutput"><span class="identifier">time_point</span></code>s
+ associated with different clocks are generally not interoperable unless
+ the relationship between the epochs associated with each clock is known.
+ </p>
+<a name="boost_chrono.overview.motivation.time_point.so_what_exactly_is_a__code__phrase_role__identifier__time_point__phrase___code__and_how_do_i_use_one_"></a><h5>
+<a name="id4815185"></a>
+ <a href="motivation.html#boost_chrono.overview.motivation.time_point.so_what_exactly_is_a__code__phrase_role__identifier__time_point__phrase___code__and_how_do_i_use_one_">So
+ What Exactly is a <code class="computeroutput"><span class="identifier">time_point</span></code>
+ and How Do I Use One?</a>
+ </h5>
+<p>
+ A <code class="computeroutput"><span class="identifier">time_point</span></code> has a clock
+ and a <code class="computeroutput"><span class="identifier">duration</span></code>.
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration</span> <span class="special">=</span> <span class="keyword">typename</span> <span class="identifier">Clock</span><span class="special">::</span><span class="identifier">duration</span><span class="special">&gt;</span> <span class="keyword">class</span> <span class="identifier">time_point</span><span class="special">;</span>
+</pre>
+<p>
+ The <code class="computeroutput"><span class="identifier">time_point</span></code>'s clock
+ is not stored. It is simply embedded into the <code class="computeroutput"><span class="identifier">time_point</span></code>'s
+ type and serves two purposes:
+ </p>
+<div class="orderedlist"><ol type="1">
+<li>
+ Because <code class="computeroutput"><span class="identifier">time_point</span></code>s originating
+ from different clocks have different types, the compiler can be instructed
+ to fail if incompatible <code class="computeroutput"><span class="identifier">time_point</span></code>s
+ are used in inappropriate ways.
+ </li>
+<li>
+ Given a <code class="computeroutput"><span class="identifier">time_point</span></code>, one
+ often needs to compare that <code class="computeroutput"><span class="identifier">time_point</span></code>
+ to "now". This is very simple as long as the <code class="computeroutput"><span class="identifier">time_point</span></code> knows what clock it is defined
+ with respect to.
+ </li>
+</ol></div>
+<p>
+ A <code class="computeroutput"><span class="identifier">time_point</span></code>'s <code class="computeroutput"><span class="identifier">duration</span></code> is stored as the only data member
+ of the <code class="computeroutput"><span class="identifier">time_point</span></code>. Thus
+ <code class="computeroutput"><span class="identifier">time_point</span></code>s and their corresponding
+ <code class="computeroutput"><span class="identifier">duration</span></code> have exactly the
+ same layout. But they have very different meanings. For example, it is
+ one thing to say I want to sleep for 3 minutes. It is a completely different
+ thing to say I want to sleep until 3 minutes past the time I started that
+ timer (unless you just happened to start that timer now). Both meanings
+ (and options for sleeping) have great practical value in common use cases
+ for sleeping, waiting on a condition variable, and waiting for a mutex's
+ lock. These same concepts and tools are found (for example) in Ada.
+ </p>
+<p>
+ A timer example:
+ </p>
+<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">f</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="identifier">monotonic_clock</span><span class="special">::</span><span class="identifier">time_point</span> <span class="identifier">start</span> <span class="special">=</span> <span class="identifier">monotonic_clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">();</span>
+ <span class="identifier">g</span><span class="special">();</span>
+ <span class="identifier">h</span><span class="special">();</span>
+ <span class="identifier">duration</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span> <span class="identifier">sec</span> <span class="special">=</span> <span class="identifier">monotonic_clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">()</span> <span class="special">-</span> <span class="identifier">start</span><span class="special">;</span>
+ <span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"f() took "</span> <span class="special">&lt;&lt;</span> <span class="identifier">sec</span><span class="special">.</span><span class="identifier">count</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="string">" seconds\n"</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ Note that if one is using the <code class="computeroutput"><span class="identifier">duration</span></code>
+ between two clock <code class="computeroutput"><span class="identifier">time_point</span></code>s
+ in a way where the precision of the <code class="computeroutput"><span class="identifier">duration</span></code>
+ matters, it is good practice to convert the clock's native <code class="computeroutput"><span class="identifier">duration</span></code> to a known <code class="computeroutput"><span class="identifier">duration</span></code>.
+ This insulates the code from future changes which may be made to the clock's
+ native precision in the future. For example monotonic_clock could easily
+ be based on the clock speed of the cpu. When you upgrade to a faster machine,
+ you do not want your code that assumed a certain tick period of this clock
+ to start experiencing run time failures because your timing code has silently
+ changed meaning.
+ </p>
+<p>
+ A delay loop example:
+ </p>
+<pre class="programlisting"><span class="comment">// delay for at least 500 nanoseconds:
+</span><span class="keyword">auto</span> <span class="identifier">go</span> <span class="special">=</span> <span class="identifier">monotonic_clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">nanoseconds</span><span class="special">(</span><span class="number">500</span><span class="special">);</span>
+<span class="keyword">while</span> <span class="special">(</span><span class="identifier">monotonic_clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">()</span> <span class="special">&lt;</span> <span class="identifier">go</span><span class="special">)</span>
+ <span class="special">;</span>
+</pre>
+<p>
+ The above code will delay as close as possible to half a microsecond, no
+ matter what the precision of monotonic_clock is. The more precise <code class="computeroutput"><span class="identifier">monotonic_clock</span></code> becomes, the more accurate
+ will be the delay to 500 nanoseconds.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.overview.motivation.timers"></a>Timers
+</h4></div></div></div>
+<p>
+ Knowing how long a program takes to execute is useful in both test and
+ production environments. It is also helpful if such timing information
+ is broken down into real (wall clock) time, CPU time spent by the user,
+ and CPU time spent by the operating system servicing user requests.
+ </p>
+<p>
+ The Boost Chrono Library's process times components provide that information:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ At the highest level, class <code class="computeroutput"><span class="identifier">run_timer</span></code>
+ provides a complete run time reporting package that can be invoked in
+ a single line of code.
+ </li>
+<li>
+ At a middle level, class <code class="computeroutput"><span class="identifier">process_timer</span></code>
+ provides a process timer useful when the automatic reporting of <code class="computeroutput"><span class="identifier">run_timer</span></code> isn't desired.
+ </li>
+<li>
+ At the lowest level, <code class="computeroutput"><span class="identifier">process_clock</span></code>
+ provides a thin wrapper around the operating system's process timer API.
+ For POSIX-like systems, that's the times() function, while for Windows,
+ it's the GetProcessTimes() function.
+ </li>
+</ul></div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../overview.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../users_guide.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,87 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Reference</title>
+<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../index.html" title="Boost.Chrono">
+<link rel="up" href="../index.html" title="Boost.Chrono">
+<link rel="prev" href="users_guide/ext_references.html" title=" References">
+<link rel="next" href="reference/common_type_hpp.html" title=" Header &lt;boost/type_traits/common_type.hpp&gt;">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="users_guide/ext_references.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="reference/common_type_hpp.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_chrono.reference"></a>Reference
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"> Header <boost/type_traits/common_type.hpp></span></dt>
+<dd><dl><dt><span class="section"><a href="reference/common_type_hpp.html#boost_chrono.reference.common_type_hpp.common_type">
+ Class Template <code class="computeroutput"><span class="identifier">common_type</span></code></a></span></dt></dl></dd>
+<dt><span class="section"> Header <boost/ratio.hpp></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="reference/ratio_hpp.html#boost_chrono.reference.ratio_hpp.ratio"> Class Template
+ <code class="computeroutput"><span class="identifier">ratio</span><span class="special">&lt;&gt;</span></code></a></span></dt>
+<dt><span class="section"><a href="reference/ratio_hpp.html#boost_chrono.reference.ratio_hpp.ratio_arithmetic">
+ <code class="computeroutput"><span class="identifier">ratio</span></code> arithmetic</a></span></dt>
+<dt><span class="section"><a href="reference/ratio_hpp.html#boost_chrono.reference.ratio_hpp.ratio_comparison">
+ <code class="computeroutput"><span class="identifier">ratio</span></code> comparison</a></span></dt>
+<dt><span class="section"><a href="reference/ratio_hpp.html#boost_chrono.reference.ratio_hpp.ration_SI_typedefs">
+ SI typedefs</a></span></dt>
+</dl></dd>
+<dt><span class="section"> Header <boost/chrono.hpp></span></dt>
+<dd><dl>
+<dt><span class="section">Clock Requirements</span></dt>
+<dt><span class="section"><a href="reference/chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_related_traits">Time-related
+ traits</a></span></dt>
+<dt><span class="section"><a href="reference/chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_">Class
+ template <code class="computeroutput"><span class="identifier">duration</span></code></a></span></dt>
+<dt><span class="section"><a href="reference/chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_non_member_arithmetic">duration
+ non-member arithmetic</a></span></dt>
+<dt><span class="section"><a href="reference/chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_comparaisons">duration
+ comparaisons</a></span></dt>
+<dt><span class="section"><a href="reference/chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_cast"> Non-Member
+ function <code class="computeroutput"><span class="identifier">duration_cast</span><span class="special">(</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="reference/chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_">Class
+ template <code class="computeroutput"><span class="identifier">time_point</span></code></a></span></dt>
+<dt><span class="section"><a href="reference/chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_non_member_arithmetic">time_point
+ non-member arithmetic</a></span></dt>
+<dt><span class="section"><a href="reference/chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_comparisons">time_point
+ comparisons</a></span></dt>
+<dt><span class="section"><a href="reference/chrono_hpp.html#boost_chrono.reference.chrono_hpp.class__system_clock_">Class
+ <code class="computeroutput"><span class="identifier">system_clock</span></code></a></span></dt>
+<dt><span class="section"><a href="reference/chrono_hpp.html#boost_chrono.reference.chrono_hpp.class__monotonic_clock_">Class
+ <code class="computeroutput"><span class="identifier">monotonic_clock</span></code></a></span></dt>
+<dt><span class="section"><a href="reference/chrono_hpp.html#boost_chrono.reference.chrono_hpp.class__high_resolution_clock_">Class
+ <code class="computeroutput"><span class="identifier">high_resolution_clock</span></code></a></span></dt>
+</dl></dd>
+<dt><span class="section"> Header <boost/chrono/timer.hpp></span></dt>
+<dt><span class="section"> Header <boost/chrono/process_times.hpp></span></dt>
+</dl></div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="users_guide/ext_references.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="reference/common_type_hpp.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/chrono_hpp.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/chrono_hpp.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,1873 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title> Header &lt;boost/chrono.hpp&gt;</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../../index.html" title="Boost.Chrono">
+<link rel="up" href="../reference.html" title="Reference">
+<link rel="prev" href="ratio_hpp.html" title=" Header &lt;boost/ratio.hpp&gt;">
+<link rel="next" href="timer_hpp.html" title=" Header &lt;boost/chrono/timer.hpp&gt;">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="ratio_hpp.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="timer_hpp.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_chrono.reference.chrono_hpp"></a> Header <boost/chrono.hpp>
+</h3></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Clock Requirements</span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_related_traits">Time-related
+ traits</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_related_traits.treat_as_floating_point">
+ Metafunction <code class="computeroutput"><span class="identifier">treat_as_floating_point</span><span class="special">&lt;&gt;</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_related_traits.duration_values">
+ Class template <code class="computeroutput"><span class="identifier">duration_values</span></code></a></span></dt>
+<dt><span class="section">common_type specializations</span></dt>
+</dl></dd>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_">Class
+ template <code class="computeroutput"><span class="identifier">duration</span></code></a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_c_1">
+ Constructor <code class="computeroutput"><span class="identifier">duration</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Rep2</span><span class="special">&amp;)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_c_2">
+ Constructor <code class="computeroutput"><span class="identifier">duration</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.count">
+ Member function <code class="computeroutput"><span class="identifier">count</span><span class="special">()</span>
+ <span class="keyword">const</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_p">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">+()</span>
+ <span class="keyword">const</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_m">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">+()</span>
+ <span class="keyword">const</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_pp">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">++()</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_pp2">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">++(</span><span class="keyword">int</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_mm">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">++()</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_mm2">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">++(</span><span class="keyword">int</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_pa">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">+=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_ma">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">-=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_moda">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">%=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_proda">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">*=(</span><span class="keyword">const</span> <span class="identifier">rep</span><span class="special">&amp;)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_da">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">/=(</span><span class="keyword">const</span> <span class="identifier">rep</span><span class="special">&amp;)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_moda_2">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">%=(</span><span class="keyword">const</span> <span class="identifier">rep</span><span class="special">&amp;)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_zero">
+ Static Member function <code class="computeroutput"><span class="identifier">zero</span><span class="special">()</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_min">
+ Static Member function <code class="computeroutput"><span class="identifier">min</span><span class="special">()</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_max">
+ Static Member function <code class="computeroutput"><span class="identifier">max</span><span class="special">()</span></code></a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_non_member_arithmetic">duration
+ non-member arithmetic</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_non_member_arithmetic.duration_operator_p_1">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">+(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_non_member_arithmetic.duration_operator_m_1">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">-(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_non_member_arithmetic.duration_operator_prod_1">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">*(</span><span class="identifier">Rep1</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_non_member_arithmetic.duration_operator_d_1">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">/(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">Rep2</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_non_member_arithmetic.duration_operator_d_2">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">/(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_comparaisons">duration
+ comparaisons</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_comparaisons.duration_operator_eq_1">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">==(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_comparaisons.duration_operator_neq_1">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">!=(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_comparaisons.duration_operator_lt_1">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">&lt;(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_comparaisons.duration_operator_leq_1">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">&lt;=(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_comparaisons.duration_operator_gt_1">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">&gt;(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_comparaisons.duration_operator_gteq_1">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">&gt;=(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_cast"> Non-Member
+ function <code class="computeroutput"><span class="identifier">duration_cast</span><span class="special">(</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_">Class
+ template <code class="computeroutput"><span class="identifier">time_point</span></code></a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_c_1">
+ Constructor <code class="computeroutput"><span class="identifier">time_point</span><span class="special">()</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_c_2">
+ Constructor <code class="computeroutput"><span class="identifier">time_point</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_c_3">
+ Constructor <code class="computeroutput"><span class="identifier">time_point</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_.time_since_epoch">
+ Member function <code class="computeroutput"><span class="identifier">time_since_epoch</span><span class="special">()</span> <span class="keyword">const</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_operator_pe">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">+=</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_operator_me">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">-=</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_min">
+ Static Member function <code class="computeroutput"><span class="identifier">min</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_max">
+ Static Member function <code class="computeroutput"><span class="identifier">max</span></code></a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_non_member_arithmetic">time_point
+ non-member arithmetic</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_non_member_arithmetic.time_point_operator_p_1">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">+(</span><span class="identifier">time_point</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_non_member_arithmetic.time_point_operator_p_2">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">+(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">time_point</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_non_member_arithmetic.time_point_operator_m_1">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">-(</span><span class="identifier">time_point</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_non_member_arithmetic.time_point_operator_m_2">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">-(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">time_point</span><span class="special">)</span></code></a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_comparisons">time_point
+ comparisons</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_operator_eq">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">==(</span><span class="identifier">time_point</span><span class="special">,</span><span class="identifier">time_point</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_operator_neq">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">!=(</span><span class="identifier">time_point</span><span class="special">,</span><span class="identifier">time_point</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_operator_lt">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">&lt;(</span><span class="identifier">time_point</span><span class="special">,</span><span class="identifier">time_point</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_operator_leq">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">&lt;=(</span><span class="identifier">time_point</span><span class="special">,</span><span class="identifier">time_point</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_operator_gt">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">&gt;(</span><span class="identifier">time_point</span><span class="special">,</span><span class="identifier">time_point</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_operator_geq">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">&gt;=(</span><span class="identifier">time_point</span><span class="special">,</span><span class="identifier">time_point</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_cast">
+ Non-Member function <code class="computeroutput"><span class="identifier">time_point_cast</span><span class="special">(</span><span class="identifier">time_point</span><span class="special">)</span></code></a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class__system_clock_">Class
+ <code class="computeroutput"><span class="identifier">system_clock</span></code></a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class__system_clock_.to_time_t">
+ Non-Member function <code class="computeroutput"><span class="identifier">to_time_t</span><span class="special">(</span><span class="identifier">time_point</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class__system_clock_.from_time_t">
+ Non-Member function <code class="computeroutput"><span class="identifier">from_time_t</span><span class="special">(</span><span class="identifier">time_t</span><span class="special">)</span></code></a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class__monotonic_clock_">Class
+ <code class="computeroutput"><span class="identifier">monotonic_clock</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class__high_resolution_clock_">Class
+ <code class="computeroutput"><span class="identifier">high_resolution_clock</span></code></a></span></dt>
+</dl></div>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
+<span class="keyword">namespace</span> <span class="identifier">chrono</span> <span class="special">{</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period</span> <span class="special">=</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">1</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="keyword">class</span> <span class="identifier">duration</span><span class="special">;</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration</span> <span class="special">=</span> <span class="keyword">typename</span> <span class="identifier">Clock</span><span class="special">::</span><span class="identifier">duration</span><span class="special">&gt;</span> <span class="keyword">class</span> <span class="identifier">time_point</span><span class="special">;</span>
+
+<span class="special">}</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+ <span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">chrono</span><span class="special">::</span><span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;,</span>
+ <span class="identifier">chrono</span><span class="special">::</span><span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;</span> <span class="special">&gt;;</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration2</span><span class="special">&gt;</span>
+ <span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">chrono</span><span class="special">::</span><span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration1</span><span class="special">&gt;,</span>
+ <span class="identifier">chrono</span><span class="special">::</span><span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration2</span><span class="special">&gt;</span> <span class="special">&gt;;</span>
+
+<span class="keyword">namespace</span> <span class="identifier">chrono</span> <span class="special">{</span>
+
+ <span class="comment">// customization traits
+</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">treat_as_floating_point</span><span class="special">;</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">duration_values</span><span class="special">;</span>
+
+ <span class="comment">// duration arithmetic
+</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+ <span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;,</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;</span> <span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="keyword">operator</span><span class="special">+(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+ <span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;,</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;</span> <span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="keyword">operator</span><span class="special">-(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">&gt;</span>
+ <span class="identifier">duration</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Rep2</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span> <span class="identifier">Period</span><span class="special">&gt;</span>
+ <span class="keyword">operator</span><span class="special">*(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period</span><span class="special">&gt;&amp;</span> <span class="identifier">d</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Rep2</span><span class="special">&amp;</span> <span class="identifier">s</span><span class="special">);</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">&gt;</span>
+ <span class="identifier">duration</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Rep2</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span> <span class="identifier">Period</span><span class="special">&gt;</span>
+ <span class="keyword">operator</span><span class="special">*(</span><span class="keyword">const</span> <span class="identifier">Rep1</span><span class="special">&amp;</span> <span class="identifier">s</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period</span><span class="special">&gt;&amp;</span> <span class="identifier">d</span><span class="special">);</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">&gt;</span>
+ <span class="identifier">duration</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Rep2</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span> <span class="identifier">Period</span><span class="special">&gt;</span>
+ <span class="keyword">operator</span><span class="special">/(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period</span><span class="special">&gt;&amp;</span> <span class="identifier">d</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Rep2</span><span class="special">&amp;</span> <span class="identifier">s</span><span class="special">);</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+ <span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Rep2</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="keyword">operator</span><span class="special">/(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+
+ <span class="comment">// duration comparisons
+</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+ <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">==(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+ <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">!=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+ <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&lt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+ <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&lt;=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+ <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&gt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+ <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&gt;=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+
+ <span class="comment">// duration_cast
+</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">ToDuration</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period</span><span class="special">&gt;</span>
+ <span class="identifier">ToDuration</span> <span class="identifier">duration_cast</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep</span><span class="special">,</span> <span class="identifier">Period</span><span class="special">&gt;&amp;</span> <span class="identifier">d</span><span class="special">);</span>
+
+ <span class="comment">// convenience typedefs
+</span> <span class="keyword">typedef</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">int_least64_t</span><span class="special">,</span> <span class="identifier">nano</span><span class="special">&gt;</span> <span class="identifier">nanoseconds</span><span class="special">;</span> <span class="comment">// at least 64 bits needed
+</span> <span class="keyword">typedef</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">int_least64_t</span><span class="special">,</span> <span class="identifier">micro</span><span class="special">&gt;</span> <span class="identifier">microseconds</span><span class="special">;</span> <span class="comment">// at least 55 bits needed
+</span> <span class="keyword">typedef</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">int_least64_t</span><span class="special">,</span> <span class="identifier">milli</span><span class="special">&gt;</span> <span class="identifier">milliseconds</span><span class="special">;</span> <span class="comment">// at least 45 bits needed
+</span> <span class="keyword">typedef</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">int_least64_t</span><span class="special">&gt;</span> <span class="identifier">seconds</span><span class="special">;</span> <span class="comment">// at least 35 bits needed
+</span> <span class="keyword">typedef</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">int_least32_t</span><span class="special">,</span> <span class="identifier">ratio</span><span class="special">&lt;</span> <span class="number">60</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">minutes</span><span class="special">;</span> <span class="comment">// at least 29 bits needed
+</span> <span class="keyword">typedef</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">int_least32_t</span><span class="special">,</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">3600</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">hours</span><span class="special">;</span> <span class="comment">// at least 23 bits needed
+</span>
+ <span class="comment">// time_point arithmetic
+</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+ <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">Duration1</span><span class="special">,</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;</span> <span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&gt;</span>
+ <span class="keyword">operator</span><span class="special">+(</span><span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration2</span><span class="special">&gt;</span>
+ <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;,</span> <span class="identifier">Duration2</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&gt;</span>
+ <span class="keyword">operator</span><span class="special">+(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+ <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">Duration1</span><span class="special">,</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;</span> <span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&gt;</span>
+ <span class="keyword">operator</span><span class="special">-(</span><span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration2</span><span class="special">&gt;</span>
+ <span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">Duration1</span><span class="special">,</span> <span class="identifier">Duration2</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="keyword">operator</span><span class="special">-(</span><span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span>
+ <span class="identifier">Duration2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+
+ <span class="comment">// time_point comparisons
+</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration2</span><span class="special">&gt;</span>
+ <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">==(</span><span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span>
+ <span class="identifier">Duration2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration2</span><span class="special">&gt;</span>
+ <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">!=(</span><span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span>
+ <span class="identifier">Duration2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration2</span><span class="special">&gt;</span>
+ <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&lt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span>
+ <span class="identifier">Duration2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration2</span><span class="special">&gt;</span>
+ <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&lt;=(</span><span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span>
+ <span class="identifier">Duration2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration2</span><span class="special">&gt;</span>
+ <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&gt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span>
+ <span class="identifier">Duration2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration2</span><span class="special">&gt;</span>
+ <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&gt;=(</span><span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span>
+ <span class="identifier">Duration2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+
+ <span class="comment">// time_point_cast
+</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">ToDuration</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration</span><span class="special">&gt;</span>
+ <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">ToDuration</span><span class="special">&gt;</span> <span class="identifier">time_point_cast</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration</span><span class="special">&gt;&amp;</span> <span class="identifier">t</span><span class="special">);</span>
+
+ <span class="comment">// Clocks
+</span> <span class="keyword">class</span> <span class="identifier">system_clock</span><span class="special">;</span>
+ <span class="keyword">class</span> <span class="identifier">monotonic_clock</span><span class="special">;</span>
+ <span class="keyword">class</span> <span class="identifier">high_resolution_clock</span><span class="special">;</span>
+
+<span class="special">}</span>
+<span class="special">}</span>
+</pre>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.reference.chrono_hpp._clock__requirements"></a>Clock Requirements
+</h4></div></div></div>
+<p>
+ A clock represents a bundle consisting of a native <code class="computeroutput"><span class="identifier">duration</span></code>,
+ a native <code class="computeroutput"><span class="identifier">time_point</span></code>, and
+ a function <code class="computeroutput"><span class="identifier">now</span><span class="special">()</span></code>
+ to get the current <code class="computeroutput"><span class="identifier">time_point</span></code>.
+ A clock shall meet the requirements in the following Table.
+ </p>
+<p>
+ In this table <code class="computeroutput"><span class="identifier">C1</span></code> and <code class="computeroutput"><span class="identifier">C2</span></code> denote <code class="computeroutput"><span class="identifier">clock</span></code>
+ types. <code class="computeroutput"><span class="identifier">t1</span></code> and <code class="computeroutput"><span class="identifier">t2</span></code> are values returned from <code class="computeroutput"><span class="identifier">C1</span><span class="special">::</span><span class="identifier">now</span><span class="special">()</span></code>
+ where the call returning <code class="computeroutput"><span class="identifier">t1</span></code>
+ happens before the call returning <code class="computeroutput"><span class="identifier">t2</span></code>
+ and both of these calls happen before <code class="computeroutput"><span class="identifier">C1</span><span class="special">::</span><span class="identifier">time_point</span><span class="special">::</span><span class="identifier">max</span><span class="special">()</span></code>.
+ </p>
+<div class="table">
+<a name="id4829182"></a><p class="title"><b>Table 1. Clock Requirements</b></p>
+<table class="table" summary="Clock Requirements">
+<colgroup>
+<col>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ expression
+ </p>
+ </th>
+<th>
+ <p>
+ return type
+ </p>
+ </th>
+<th>
+ <p>
+ operational semantics
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">C1</span><span class="special">::</span><span class="identifier">rep</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ An arithmetic type or class emulating an arithmetic type.
+ </p>
+ </td>
+<td>
+ <p>
+ The representation type of the native <code class="computeroutput"><span class="identifier">duration</span></code>
+ and <code class="computeroutput"><span class="identifier">time_point</span></code>.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">C1</span><span class="special">::</span><span class="identifier">period</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">ratio</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ The tick period of the clock in seconds.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">C1</span><span class="special">::</span><span class="identifier">duration</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">chrono</span><span class="special">::</span><span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">C1</span><span class="special">::</span><span class="identifier">rep</span><span class="special">,</span>
+ <span class="identifier">C1</span><span class="special">::</span><span class="identifier">period</span><span class="special">&gt;</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ The native <code class="computeroutput"><span class="identifier">duration</span></code>
+ type of the <code class="computeroutput"><span class="identifier">clock</span></code>.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">C1</span><span class="special">::</span><span class="identifier">time_point</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">chrono</span><span class="special">::</span><span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">C1</span><span class="special">&gt;</span>
+ <span class="keyword">or</span> <span class="identifier">chrono</span><span class="special">::</span><span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">C2</span><span class="special">,</span> <span class="identifier">C1</span><span class="special">::</span><span class="identifier">duration</span><span class="special">&gt;</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ The native <code class="computeroutput"><span class="identifier">time_point</span></code>
+ type of the <code class="computeroutput"><span class="identifier">clock</span></code>.
+ Different clocks are permitted to share a <code class="computeroutput"><span class="identifier">time_point</span></code>
+ definition if it is valid to compare their time_points by comparing
+ their respective <code class="computeroutput"><span class="identifier">duration</span></code>s.
+ <code class="computeroutput"><span class="identifier">C1</span></code> and <code class="computeroutput"><span class="identifier">C2</span></code> shall refer to the same epoch.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">C1</span><span class="special">::</span><span class="identifier">is_monotonic</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="keyword">const</span> <span class="keyword">bool</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="keyword">true</span></code> if <code class="computeroutput"><span class="identifier">t1</span> <span class="special">&lt;=</span>
+ <span class="identifier">t2</span></code> is always <code class="computeroutput"><span class="keyword">true</span></code>, else <code class="computeroutput"><span class="keyword">false</span></code>.
+ <span class="bold"><strong>Note: A <code class="computeroutput"><span class="identifier">clock</span></code>
+ that can be adjusted backwards is not monotonic</strong></span>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">C1</span><span class="special">::</span><span class="identifier">now</span><span class="special">()</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">C1</span><span class="special">::</span><span class="identifier">time_point</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Returns a <code class="computeroutput"><span class="identifier">time_point</span></code>
+ representing the current point in time.
+ </p>
+ </td>
+</tr>
+</tbody>
+</table>
+</div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.reference.chrono_hpp.time_related_traits"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_related_traits" title="Time-related
+ traits">Time-related
+ traits</a>
+</h4></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_related_traits.treat_as_floating_point">
+ Metafunction <code class="computeroutput"><span class="identifier">treat_as_floating_point</span><span class="special">&lt;&gt;</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_related_traits.duration_values">
+ Class template <code class="computeroutput"><span class="identifier">duration_values</span></code></a></span></dt>
+<dt><span class="section">common_type specializations</span></dt>
+</dl></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.time_related_traits.treat_as_floating_point"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_related_traits.treat_as_floating_point" title="
+ Metafunction treat_as_floating_point&lt;&gt;">
+ Metafunction <code class="computeroutput"><span class="identifier">treat_as_floating_point</span><span class="special">&lt;&gt;</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">treat_as_floating_point</span>
+ <span class="special">:</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_floating_point</span><span class="special">&lt;</span><span class="identifier">Rep</span><span class="special">&gt;</span> <span class="special">{};</span>
+</pre>
+<p>
+ The <code class="computeroutput"><span class="identifier">duration</span></code> template
+ uses the <code class="computeroutput"><span class="identifier">treat_as_floating_point</span></code>
+ trait to help determine if a <code class="computeroutput"><span class="identifier">duration</span></code>
+ with one tick period can be converted to another <code class="computeroutput"><span class="identifier">duration</span></code>
+ with a different tick period. If <code class="computeroutput"><span class="identifier">treat_as_floating_point</span><span class="special">&lt;</span><span class="identifier">Rep</span><span class="special">&gt;::</span><span class="identifier">value</span></code>
+ is <code class="computeroutput"><span class="keyword">true</span></code>, then <code class="computeroutput"><span class="identifier">Rep</span></code> is a floating point type and implicit
+ conversions are allowed among <code class="computeroutput"><span class="identifier">duration</span></code>s.
+ Otherwise, the implicit convertibility depends on the tick periods of
+ the <code class="computeroutput"><span class="identifier">duration</span></code>s. If <code class="computeroutput"><span class="identifier">Rep</span></code> is a class type which emulates
+ a floating point type, the author of <code class="computeroutput"><span class="identifier">Rep</span></code>
+ can specialize <code class="computeroutput"><span class="identifier">treat_as_floating_point</span></code>
+ so that <code class="computeroutput"><span class="identifier">duration</span></code> will
+ treat this <code class="computeroutput"><span class="identifier">Rep</span></code> as if
+ it were a floating point type. Otherwise <code class="computeroutput"><span class="identifier">Rep</span></code>
+ is assumed to be an integral type, or a class emulating an integral type.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.time_related_traits.duration_values"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_related_traits.duration_values" title="
+ Class template duration_values">
+ Class template <code class="computeroutput"><span class="identifier">duration_values</span></code></a>
+</h5></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_related_traits.duration_values.zero">
+ Static member function<code class="computeroutput"><span class="identifier">zero</span><span class="special">()</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_related_traits.duration_values.max">
+ Static member function <code class="computeroutput"><span class="identifier">max</span><span class="special">()</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_related_traits.duration_values.min">
+ Static member function <code class="computeroutput"><span class="identifier">min</span><span class="special">()</span></code></a></span></dt>
+</dl></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep</span><span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">duration_values</span>
+<span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">static</span> <span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">Rep</span> <span class="identifier">zero</span><span class="special">();</span>
+ <span class="keyword">static</span> <span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">Rep</span> <span class="identifier">max</span><span class="special">();</span>
+ <span class="keyword">static</span> <span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">Rep</span> <span class="identifier">min</span><span class="special">();</span>
+<span class="special">};</span>
+</pre>
+<p>
+ The <code class="computeroutput"><span class="identifier">duration</span></code> template
+ uses the <code class="computeroutput"><span class="identifier">duration_values</span></code>
+ trait to construct special values of the <code class="computeroutput"><span class="identifier">duration</span></code>s
+ representation (<code class="computeroutput"><span class="identifier">Rep</span></code>).
+ This is done because the representation might be a class type with behavior
+ which requires some other implementation to return these special values.
+ In that case, the author of that class type should specialize <code class="computeroutput"><span class="identifier">duration_values</span></code> to return the indicated
+ values.
+ </p>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h6 class="title">
+<a name="boost_chrono.reference.chrono_hpp.time_related_traits.duration_values.zero"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_related_traits.duration_values.zero" title="
+ Static member functionzero()">
+ Static member function<code class="computeroutput"><span class="identifier">zero</span><span class="special">()</span></code></a>
+</h6></div></div></div>
+<pre class="programlisting"><span class="keyword">static</span> <span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">Rep</span> <span class="identifier">zero</span><span class="special">();</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">Rep</span><span class="special">(</span><span class="number">0</span><span class="special">)</span></code>.
+ <span class="bold"><strong>Note:</strong></span> <code class="computeroutput"><span class="identifier">Rep</span><span class="special">(</span><span class="number">0</span><span class="special">)</span></code>
+ is specified instead of <code class="computeroutput"><span class="identifier">Rep</span><span class="special">()</span></code> since <code class="computeroutput"><span class="identifier">Rep</span><span class="special">()</span></code> may have some other meaning, such
+ as an uninitialized value.
+ </p>
+<p>
+ <span class="bold"><strong>Remarks:</strong></span> The value returned shall
+ correspond to the additive identity.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h6 class="title">
+<a name="boost_chrono.reference.chrono_hpp.time_related_traits.duration_values.max"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_related_traits.duration_values.max" title="
+ Static member function max()">
+ Static member function <code class="computeroutput"><span class="identifier">max</span><span class="special">()</span></code></a>
+</h6></div></div></div>
+<pre class="programlisting"><span class="keyword">static</span> <span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">Rep</span> <span class="identifier">max</span><span class="special">();</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">Rep</span><span class="special">&gt;::</span><span class="identifier">max</span><span class="special">()</span></code>.
+ </p>
+<p>
+ <span class="bold"><strong>Remarks:</strong></span> The value returned shall
+ compare greater than zero().
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h6 class="title">
+<a name="boost_chrono.reference.chrono_hpp.time_related_traits.duration_values.min"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_related_traits.duration_values.min" title="
+ Static member function min()">
+ Static member function <code class="computeroutput"><span class="identifier">min</span><span class="special">()</span></code></a>
+</h6></div></div></div>
+<pre class="programlisting"><span class="keyword">static</span> <span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">Rep</span> <span class="identifier">min</span><span class="special">();</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">Rep</span><span class="special">&gt;::</span><span class="identifier">lowest</span><span class="special">()</span></code>.
+ </p>
+<p>
+ <span class="bold"><strong>Remarks:</strong></span> The value returned shall
+ compare less than or equal to <code class="computeroutput"><span class="identifier">zero</span><span class="special">()</span></code>.
+ </p>
+</div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.time_related_traits._common_type__specializations"></a>common_type specializations
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">chrono</span><span class="special">::</span><span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;,</span> <span class="identifier">chrono</span><span class="special">::</span><span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;</span> <span class="special">&gt;</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="identifier">chrono</span><span class="special">::</span><span class="identifier">duration</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Rep2</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span> <span class="identifier">see</span> <span class="identifier">below</span><span class="special">&gt;</span> <span class="identifier">type</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ The period of the <code class="computeroutput"><span class="identifier">duration</span></code>
+ indicated by this specialization of <code class="computeroutput"><span class="identifier">common_type</span></code>
+ shall be the greatest common divisor of <code class="computeroutput"><span class="identifier">Period1</span></code>
+ and <code class="computeroutput"><span class="identifier">Period2</span></code>. This can
+ be computed by forming a <code class="computeroutput"><span class="identifier">ratio</span></code>
+ of the greatest common divisor of <code class="computeroutput"><span class="identifier">Period1</span><span class="special">::</span><span class="identifier">num</span></code>
+ and <code class="computeroutput"><span class="identifier">Period2</span><span class="special">::</span><span class="identifier">num</span></code>, and the least common multiple
+ of <code class="computeroutput"><span class="identifier">Period1</span><span class="special">::</span><span class="identifier">den</span></code> and <code class="computeroutput"><span class="identifier">Period2</span><span class="special">::</span><span class="identifier">den</span></code>.
+ </p>
+<p>
+ <span class="bold"><strong>Note:</strong></span> The typedef type is the <code class="computeroutput"><span class="identifier">duration</span></code> with the largest tick period
+ possible where both <code class="computeroutput"><span class="identifier">duration</span></code>
+ arguments will convert to it without requiring a division operation.
+ The representation of this type is intended to be able to hold any value
+ resulting from this conversion, with the possible exception of round-off
+ error when floating point <code class="computeroutput"><span class="identifier">duration</span></code>s
+ are involved (but not truncation error).
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration2</span><span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">chrono</span><span class="special">::</span><span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration1</span><span class="special">&gt;,</span> <span class="identifier">chrono</span><span class="special">::</span><span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration2</span><span class="special">&gt;</span> <span class="special">&gt;</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="identifier">chrono</span><span class="special">::</span><span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">Duration1</span><span class="special">,</span> <span class="identifier">Duration2</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&gt;</span> <span class="identifier">type</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ The <code class="computeroutput"><span class="identifier">common_type</span></code> of two
+ <code class="computeroutput"><span class="identifier">time_point</span></code>s is a <code class="computeroutput"><span class="identifier">time_point</span></code> with the same <code class="computeroutput"><span class="identifier">clock</span></code> (both shall have the same <code class="computeroutput"><span class="identifier">clock</span></code>), and the <code class="computeroutput"><span class="identifier">common_type</span></code>
+ of the two <code class="computeroutput"><span class="identifier">duration</span></code>s.
+ </p>
+</div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__duration_"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_" title="Class
+ template duration">Class
+ template <code class="computeroutput"><span class="identifier">duration</span></code></a>
+</h4></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_c_1">
+ Constructor <code class="computeroutput"><span class="identifier">duration</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Rep2</span><span class="special">&amp;)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_c_2">
+ Constructor <code class="computeroutput"><span class="identifier">duration</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.count">
+ Member function <code class="computeroutput"><span class="identifier">count</span><span class="special">()</span>
+ <span class="keyword">const</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_p">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">+()</span>
+ <span class="keyword">const</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_m">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">+()</span>
+ <span class="keyword">const</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_pp">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">++()</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_pp2">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">++(</span><span class="keyword">int</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_mm">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">++()</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_mm2">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">++(</span><span class="keyword">int</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_pa">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">+=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_ma">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">-=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_moda">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">%=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_proda">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">*=(</span><span class="keyword">const</span> <span class="identifier">rep</span><span class="special">&amp;)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_da">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">/=(</span><span class="keyword">const</span> <span class="identifier">rep</span><span class="special">&amp;)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_moda_2">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">%=(</span><span class="keyword">const</span> <span class="identifier">rep</span><span class="special">&amp;)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_zero">
+ Static Member function <code class="computeroutput"><span class="identifier">zero</span><span class="special">()</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_min">
+ Static Member function <code class="computeroutput"><span class="identifier">min</span><span class="special">()</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_max">
+ Static Member function <code class="computeroutput"><span class="identifier">max</span><span class="special">()</span></code></a></span></dt>
+</dl></div>
+<p>
+ A <code class="computeroutput"><span class="identifier">duration</span></code> measures time
+ between two points in time (<code class="computeroutput"><span class="identifier">time_point</span></code>).
+ A <code class="computeroutput"><span class="identifier">duration</span></code> has a representation
+ which holds a count of ticks, and a tick period. The tick period is the
+ amount of time which occurs from one tick to another in units of a second.
+ It is expressed as a rational constant using <code class="computeroutput"><span class="identifier">ratio</span></code>.
+ </p>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">chrono</span> <span class="special">{</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period</span><span class="special">&gt;</span>
+ <span class="keyword">class</span> <span class="identifier">duration</span> <span class="special">{</span>
+ <span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="identifier">Rep</span> <span class="identifier">rep</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">Period</span> <span class="identifier">period</span><span class="special">;</span>
+ <span class="keyword">private</span><span class="special">:</span>
+ <span class="identifier">rep</span> <span class="identifier">rep_</span><span class="special">;</span> <span class="comment">// exposition only
+</span> <span class="keyword">public</span><span class="special">:</span>
+ <span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">duration</span><span class="special">()</span> <span class="special">{}</span> <span class="comment">// = default;
+</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">&gt;</span>
+ <span class="identifier">BOOST_CONSTEXPR</span> <span class="keyword">explicit</span> <span class="identifier">duration</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Rep2</span><span class="special">&amp;</span> <span class="identifier">r</span><span class="special">,</span>
+ <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">enable_if_c</span>
+ <span class="special">&lt;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_convertible</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">rep</span><span class="special">&gt;::</span><span class="identifier">value</span>
+ <span class="special">&amp;&amp;</span> <span class="special">(</span><span class="identifier">treat_as_floating_point</span><span class="special">&lt;</span><span class="identifier">rep</span><span class="special">&gt;::</span><span class="identifier">value</span>
+ <span class="special">||</span> <span class="special">(!</span><span class="identifier">treat_as_floating_point</span><span class="special">&lt;</span><span class="identifier">rep</span><span class="special">&gt;::</span><span class="identifier">value</span>
+ <span class="special">&amp;&amp;</span> <span class="special">!</span><span class="identifier">treat_as_floating_point</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">&gt;::</span><span class="identifier">value</span><span class="special">))</span>
+ <span class="special">&gt;::</span><span class="identifier">type</span><span class="special">*</span> <span class="special">=</span> <span class="number">0</span><span class="special">);</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+ <span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">duration</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;&amp;</span> <span class="identifier">d</span><span class="special">,</span>
+ <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">enable_if_c</span>
+ <span class="special">&lt;</span>
+ <span class="identifier">treat_as_floating_point</span><span class="special">&lt;</span><span class="identifier">rep</span><span class="special">&gt;::</span><span class="identifier">value</span>
+ <span class="special">||</span> <span class="special">(</span><span class="identifier">ratio_divide</span><span class="special">&lt;</span><span class="identifier">Period2</span><span class="special">,</span> <span class="identifier">period</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">den</span> <span class="special">==</span> <span class="number">1</span>
+ <span class="special">&amp;&amp;</span> <span class="special">!</span><span class="identifier">treat_as_floating_point</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">&gt;::</span><span class="identifier">value</span><span class="special">)</span>
+ <span class="special">&gt;::</span><span class="identifier">type</span><span class="special">*</span> <span class="special">=</span> <span class="number">0</span><span class="special">);</span>
+
+ <span class="comment">//~duration() = default;
+</span> <span class="comment">//duration(const duration&amp;) = default;
+</span> <span class="comment">//duration&amp; operator=(const duration&amp;) = default;
+</span>
+ <span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">rep</span> <span class="identifier">count</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+
+ <span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">duration</span> <span class="keyword">operator</span><span class="special">+();</span>
+ <span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">duration</span> <span class="keyword">operator</span><span class="special">-();</span>
+ <span class="identifier">duration</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">++();</span>
+ <span class="identifier">duration</span> <span class="keyword">operator</span><span class="special">++(</span><span class="keyword">int</span><span class="special">);</span>
+ <span class="identifier">duration</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">--();</span>
+ <span class="identifier">duration</span> <span class="keyword">operator</span><span class="special">--(</span><span class="keyword">int</span><span class="special">);</span>
+
+ <span class="identifier">duration</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">+=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;</span> <span class="identifier">d</span><span class="special">);</span>
+ <span class="identifier">duration</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">-=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;</span> <span class="identifier">d</span><span class="special">);</span>
+
+ <span class="identifier">duration</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">*=(</span><span class="keyword">const</span> <span class="identifier">rep</span><span class="special">&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+ <span class="identifier">duration</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">/=(</span><span class="keyword">const</span> <span class="identifier">rep</span><span class="special">&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+ <span class="identifier">duration</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">%=(</span><span class="keyword">const</span> <span class="identifier">rep</span><span class="special">&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+ <span class="identifier">duration</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">%=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+
+ <span class="keyword">static</span> <span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">duration</span> <span class="identifier">zero</span><span class="special">();</span>
+ <span class="keyword">static</span> <span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">duration</span> <span class="identifier">min</span><span class="special">();</span>
+ <span class="keyword">static</span> <span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">duration</span> <span class="identifier">max</span><span class="special">();</span>
+ <span class="special">};</span>
+
+<span class="special">}}</span>
+</pre>
+<p>
+ Rep shall be an arithmetic type, or a class emulating an arithmetic type.
+ If <code class="computeroutput"><span class="identifier">duration</span></code> is instantiated
+ with the type of <code class="computeroutput"><span class="identifier">Rep</span></code> being
+ a <code class="computeroutput"><span class="identifier">duration</span></code>, a diagnostic
+ is required.
+ </p>
+<p>
+ Period shall be an instantiation of <code class="computeroutput"><span class="identifier">ratio</span></code>,
+ diagnostic required.
+ </p>
+<p>
+ Period::num shall be positive, diagnostic required.
+ </p>
+<p>
+ Examples:
+ </p>
+<pre class="programlisting"><span class="identifier">duration</span><span class="special">&lt;</span><span class="keyword">long</span><span class="special">,</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">60</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">holds</span> <span class="identifier">a</span> <span class="identifier">count</span> <span class="identifier">of</span> <span class="identifier">minutes</span> <span class="keyword">using</span> <span class="identifier">a</span> <span class="keyword">long</span><span class="special">.</span>
+
+<span class="identifier">duration</span><span class="special">&lt;</span><span class="keyword">long</span> <span class="keyword">long</span><span class="special">,</span> <span class="identifier">milli</span><span class="special">&gt;</span> <span class="identifier">holds</span> <span class="identifier">a</span> <span class="identifier">count</span> <span class="identifier">of</span> <span class="identifier">milliseconds</span> <span class="keyword">using</span> <span class="identifier">a</span> <span class="keyword">long</span> <span class="keyword">long</span><span class="special">.</span>
+
+<span class="identifier">duration</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">,</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">1</span><span class="special">,</span> <span class="number">30</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">holds</span> <span class="identifier">a</span> <span class="identifier">count</span> <span class="keyword">using</span> <span class="identifier">a</span> <span class="keyword">double</span> <span class="identifier">with</span> <span class="identifier">a</span> <span class="identifier">tick</span> <span class="identifier">period</span> <span class="identifier">of</span> <span class="number">1</span><span class="special">/</span><span class="number">30</span> <span class="identifier">second</span> <span class="special">(</span><span class="identifier">a</span> <span class="identifier">tick</span> <span class="identifier">fre
quency</span> <span class="identifier">of</span> <span class="number">30</span> <span class="identifier">Hz</span><span class="special">).</span>
+</pre>
+<p>
+ The following members of <code class="computeroutput"><span class="identifier">duration</span></code>
+ do not throw an exception unless the indicated operations on the representations
+ throw an exception.
+ </p>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__duration_.duration_c_1"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_c_1" title="
+ Constructor duration(const Rep2&amp;)">
+ Constructor <code class="computeroutput"><span class="identifier">duration</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Rep2</span><span class="special">&amp;)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">&gt;</span>
+<span class="identifier">BOOST_CONSTEXPR</span> <span class="keyword">explicit</span> <span class="identifier">duration</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Rep2</span><span class="special">&amp;</span> <span class="identifier">r</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Requires:</strong></span> <code class="computeroutput"><span class="identifier">Rep2</span></code>
+ is implicitly convertible to <code class="computeroutput"><span class="identifier">rep</span></code>,
+ and
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<code class="computeroutput"><span class="identifier">treat_as_floating_point</span><span class="special">&lt;</span><span class="identifier">rep</span><span class="special">&gt;::</span><span class="identifier">value</span></code>
+ is <code class="computeroutput"><span class="keyword">true</span></code>, or
+ </li>
+<li>
+<code class="computeroutput"><span class="special">!</span><span class="identifier">treat_as_floating_point</span><span class="special">&lt;</span><span class="identifier">rep</span><span class="special">&gt;::</span><span class="identifier">value</span>
+ <span class="special">&amp;&amp;</span> <span class="special">!</span><span class="identifier">treat_as_floating_point</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">&gt;::</span><span class="identifier">value</span></code> is <code class="computeroutput"><span class="keyword">true</span></code>.
+ </li>
+</ul></div>
+<p>
+ A diagnostic is required if this requirement is not met. <span class="bold"><strong>Note:</strong></span>
+ This requirement prevents construction of an integral-based <code class="computeroutput"><span class="identifier">duration</span></code> with a floating point representation.
+ Such a construction could easily lead to confusion about the value of
+ the <code class="computeroutput"><span class="identifier">duration</span></code>.
+ </p>
+<p>
+ <span class="bold"><strong>Example:</strong></span>
+ </p>
+<pre class="programlisting"><span class="identifier">duration</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">milli</span><span class="special">&gt;</span> <span class="identifier">d</span><span class="special">(</span><span class="number">3.5</span><span class="special">);</span> <span class="comment">// shall not compile
+</span><span class="identifier">duration</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">milli</span><span class="special">&gt;</span> <span class="identifier">d</span><span class="special">(</span><span class="number">3</span><span class="special">);</span> <span class="comment">// ok
+</span></pre>
+<p>
+ <span class="bold"><strong>Effects:</strong></span> Constructs an object of type
+ <code class="computeroutput"><span class="identifier">duration</span></code>.
+ </p>
+<p>
+ <span class="bold"><strong>PostConditions:</strong></span> <code class="computeroutput"><span class="identifier">count</span><span class="special">()</span> <span class="special">==</span> <span class="keyword">static_cast</span><span class="special">&lt;</span><span class="identifier">rep</span><span class="special">&gt;(</span><span class="identifier">r</span><span class="special">)</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__duration_.duration_c_2"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_c_2" title="
+ Constructor duration(const duration&amp;)">
+ Constructor <code class="computeroutput"><span class="identifier">duration</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+<span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">duration</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;&amp;</span> <span class="identifier">d</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Requires:</strong></span> <code class="computeroutput"><span class="identifier">treat_as_floating_point</span><span class="special">&lt;</span><span class="identifier">rep</span><span class="special">&gt;::</span><span class="identifier">value</span></code>,
+ or <code class="computeroutput"><span class="identifier">ratio_divide</span><span class="special">&lt;</span><span class="identifier">Period2</span><span class="special">,</span>
+ <span class="identifier">period</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">den</span> <span class="special">==</span> <span class="number">1</span></code>.
+ </p>
+<pre class="programlisting"><span class="identifier">A</span> <span class="identifier">diagnostic</span> <span class="identifier">is</span> <span class="identifier">required</span> <span class="keyword">if</span> <span class="keyword">this</span> <span class="identifier">requirement</span> <span class="identifier">is</span> <span class="keyword">not</span> <span class="identifier">met</span><span class="special">.</span>
+</pre>
+<p>
+ <span class="bold"><strong>note</strong></span> This requirement prevents implicit
+ truncation error when converting between integral-based <code class="computeroutput"><span class="identifier">duration</span></code>s. Such a construction could
+ easily lead to confusion about the value of the <code class="computeroutput"><span class="identifier">duration</span></code>.
+ </p>
+<p>
+ <span class="bold"><strong>Example:</strong></span>
+ </p>
+<pre class="programlisting"><span class="identifier">duration</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">milli</span><span class="special">&gt;</span> <span class="identifier">ms</span><span class="special">(</span><span class="number">3</span><span class="special">);</span>
+<span class="identifier">duration</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">micro</span><span class="special">&gt;</span> <span class="identifier">us</span> <span class="special">=</span> <span class="identifier">ms</span><span class="special">;</span> <span class="comment">// ok
+</span><span class="identifier">duration</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">milli</span><span class="special">&gt;</span> <span class="identifier">ms2</span> <span class="special">=</span> <span class="identifier">us</span><span class="special">;</span> <span class="comment">// shall not compile
+</span></pre>
+<p>
+ <span class="bold"><strong>Effects:</strong></span> Constructs an object of type
+ <code class="computeroutput"><span class="identifier">duration</span></code>, constructing
+ <code class="computeroutput"><span class="identifier">rep_</span></code> from <code class="computeroutput"><span class="identifier">duration_cast</span><span class="special">&lt;</span><span class="identifier">duration</span><span class="special">&gt;(</span><span class="identifier">d</span><span class="special">).</span><span class="identifier">count</span><span class="special">()</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__duration_.count"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.count" title="
+ Member function count()
+ const">
+ Member function <code class="computeroutput"><span class="identifier">count</span><span class="special">()</span>
+ <span class="keyword">const</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">rep</span> <span class="identifier">count</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> `rep_v.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_p"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_p" title="
+ Member function operator+()
+ const">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">+()</span>
+ <span class="keyword">const</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">duration</span> <span class="keyword">operator</span><span class="special">+()</span> <span class="keyword">const</span><span class="special">;</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_m"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_m" title="
+ Member function operator+()
+ const">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">+()</span>
+ <span class="keyword">const</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">duration</span> <span class="keyword">operator</span><span class="special">-()</span> <span class="keyword">const</span><span class="special">;</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">duration</span><span class="special">(-</span><span class="identifier">rep_</span><span class="special">)</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_pp"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_pp" title="
+ Member function operator++()">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">++()</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="identifier">duration</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">++();</span>
+</pre>
+<p>
+ <span class="bold"><strong>Effects:</strong></span> <code class="computeroutput"><span class="special">++</span><span class="identifier">rep_</span></code>.
+ </p>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_pp2"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_pp2" title="
+ Member function operator++(int)">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">++(</span><span class="keyword">int</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="identifier">duration</span> <span class="keyword">operator</span><span class="special">++(</span><span class="keyword">int</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> `duration(rep_++)v.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_mm"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_mm" title="
+ Member function operator++()">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">++()</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="identifier">duration</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">--();</span>
+</pre>
+<p>
+ <span class="bold"><strong>Effects:</strong></span> <code class="computeroutput"><span class="special">--</span><span class="identifier">rep_</span></code>.
+ </p>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_mm2"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_mm2" title="
+ Member function operator++(int)">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">++(</span><span class="keyword">int</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="identifier">duration</span> <span class="keyword">operator</span><span class="special">--(</span><span class="keyword">int</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">duration</span><span class="special">(</span><span class="identifier">rep_</span><span class="special">--)</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_pa"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_pa" title="
+ Member function operator+=(const duration&amp;)">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">+=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="identifier">duration</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">+=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;</span> <span class="identifier">d</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Effects:</strong></span> <code class="computeroutput"><span class="identifier">rep_</span>
+ <span class="special">+=</span> <span class="identifier">d</span><span class="special">.</span><span class="identifier">count</span><span class="special">()</span></code>.
+ </p>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_ma"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_ma" title="
+ Member function operator-=(const duration&amp;)">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">-=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="identifier">duration</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">-=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;</span> <span class="identifier">d</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Effects:</strong></span> <code class="computeroutput"><span class="identifier">rep_</span>
+ <span class="special">-=</span> <span class="identifier">d</span><span class="special">.</span><span class="identifier">count</span><span class="special">()</span></code>.
+ </p>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_moda"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_moda" title="
+ Member function operator%=(const duration&amp;)">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">%=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="identifier">duration</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">%=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;</span> <span class="identifier">d</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Effects:</strong></span> <code class="computeroutput"><span class="identifier">rep_</span>
+ <span class="special">%=</span> <span class="identifier">d</span><span class="special">.</span><span class="identifier">count</span><span class="special">()</span></code>.
+ </p>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_proda"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_proda" title="
+ Member function operator*=(const rep&amp;)">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">*=(</span><span class="keyword">const</span> <span class="identifier">rep</span><span class="special">&amp;)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="identifier">duration</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">*=(</span><span class="keyword">const</span> <span class="identifier">rep</span><span class="special">&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Effects:</strong></span> <code class="computeroutput"><span class="identifier">rep_</span>
+ <span class="special">*=</span> <span class="identifier">rhs</span></code>.
+ </p>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_da"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_da" title="
+ Member function operator/=(const rep&amp;)">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">/=(</span><span class="keyword">const</span> <span class="identifier">rep</span><span class="special">&amp;)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="identifier">duration</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">/=(</span><span class="keyword">const</span> <span class="identifier">rep</span><span class="special">&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Effects:</strong></span> <code class="computeroutput"><span class="identifier">rep_</span>
+ <span class="special">/=</span> <span class="identifier">rhs</span></code>.
+ </p>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_moda_2"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_operator_moda_2" title="
+ Member function operator%=(const rep&amp;)">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">%=(</span><span class="keyword">const</span> <span class="identifier">rep</span><span class="special">&amp;)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="identifier">duration</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">%=(</span><span class="keyword">const</span> <span class="identifier">rep</span><span class="special">&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Effects:</strong></span> <code class="computeroutput"><span class="identifier">rep_</span>
+ <span class="special">%=</span> <span class="identifier">rhs</span></code>.
+ </p>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__duration_.duration_zero"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_zero" title="
+ Static Member function zero()">
+ Static Member function <code class="computeroutput"><span class="identifier">zero</span><span class="special">()</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">static</span> <span class="identifier">duration</span> <span class="identifier">zero</span><span class="special">();</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">duration</span><span class="special">(</span><span class="identifier">duration_values</span><span class="special">&lt;</span><span class="identifier">rep</span><span class="special">&gt;::</span><span class="identifier">zero</span><span class="special">())</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__duration_.duration_min"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_min" title="
+ Static Member function min()">
+ Static Member function <code class="computeroutput"><span class="identifier">min</span><span class="special">()</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">static</span> <span class="identifier">duration</span> <span class="identifier">min</span><span class="special">();</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">duration</span><span class="special">(</span><span class="identifier">duration_values</span><span class="special">&lt;</span><span class="identifier">rep</span><span class="special">&gt;::</span><span class="identifier">min</span><span class="special">()).</span></code>
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__duration_.duration_max"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__duration_.duration_max" title="
+ Static Member function max()">
+ Static Member function <code class="computeroutput"><span class="identifier">max</span><span class="special">()</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">static</span> <span class="identifier">constexpr</span> <span class="identifier">duration</span> <span class="identifier">max</span><span class="special">();</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">duration</span><span class="special">(</span><span class="identifier">duration_values</span><span class="special">&lt;</span><span class="identifier">rep</span><span class="special">&gt;::</span><span class="identifier">max</span><span class="special">())</span></code>.
+ </p>
+</div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.reference.chrono_hpp.duration_non_member_arithmetic"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_non_member_arithmetic" title="duration
+ non-member arithmetic">duration
+ non-member arithmetic</a>
+</h4></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_non_member_arithmetic.duration_operator_p_1">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">+(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_non_member_arithmetic.duration_operator_m_1">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">-(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_non_member_arithmetic.duration_operator_prod_1">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">*(</span><span class="identifier">Rep1</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_non_member_arithmetic.duration_operator_d_1">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">/(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">Rep2</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_non_member_arithmetic.duration_operator_d_2">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">/(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+</dl></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.duration_non_member_arithmetic.duration_operator_p_1"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_non_member_arithmetic.duration_operator_p_1" title="
+ Non-Member function operator+(duration,duration)">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">+(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+<span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;,</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;</span> <span class="special">&gt;::</span><span class="identifier">type</span>
+<span class="keyword">operator</span><span class="special">+(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">CD</span><span class="special">(</span><span class="identifier">lhs</span><span class="special">)</span> <span class="special">+=</span> <span class="identifier">rhs</span></code> where <code class="computeroutput"><span class="identifier">CD</span></code>
+ is the type of the return value.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.duration_non_member_arithmetic.duration_operator_m_1"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_non_member_arithmetic.duration_operator_m_1" title="
+ Non-Member function operator-(duration,duration)">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">-(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+<span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;,</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;</span> <span class="special">&gt;::</span><span class="identifier">type</span>
+<span class="keyword">operator</span><span class="special">-(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">CD</span><span class="special">(</span><span class="identifier">lhs</span><span class="special">)</span> <span class="special">-=</span> <span class="identifier">rhs</span></code> where <code class="computeroutput"><span class="identifier">CD</span></code>
+ is the type of the return value.
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">&gt;</span>
+<span class="identifier">duration</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Rep2</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span> <span class="identifier">Period</span><span class="special">&gt;</span>
+<span class="keyword">operator</span><span class="special">*(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period</span><span class="special">&gt;&amp;</span> <span class="identifier">d</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Rep2</span><span class="special">&amp;</span> <span class="identifier">s</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Requires:</strong></span> Let <code class="computeroutput"><span class="identifier">CR</span></code>
+ represent the <code class="computeroutput"><span class="identifier">common_type</span></code>
+ of <code class="computeroutput"><span class="identifier">Rep1</span></code> and <code class="computeroutput"><span class="identifier">Rep2</span></code>. Both <code class="computeroutput"><span class="identifier">Rep1</span></code>
+ and <code class="computeroutput"><span class="identifier">Rep2</span></code> shall be implicitly
+ convertible to <code class="computeroutput"><span class="identifier">CR</span></code>, diagnostic
+ required.
+ </p>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">CR</span><span class="special">,</span> <span class="identifier">Period</span><span class="special">&gt;(</span><span class="identifier">d</span><span class="special">)</span> <span class="special">*=</span> <span class="identifier">s</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.duration_non_member_arithmetic.duration_operator_prod_1"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_non_member_arithmetic.duration_operator_prod_1" title="
+ Non-Member function operator*(Rep1,duration)">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">*(</span><span class="identifier">Rep1</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">&gt;</span>
+<span class="identifier">duration</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Rep2</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span> <span class="identifier">Period</span><span class="special">&gt;</span>
+<span class="keyword">operator</span><span class="special">*(</span><span class="keyword">const</span> <span class="identifier">Rep1</span><span class="special">&amp;</span> <span class="identifier">s</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period</span><span class="special">&gt;&amp;</span> <span class="identifier">d</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Requires:</strong></span> Let <code class="computeroutput"><span class="identifier">CR</span></code>
+ represent the <code class="computeroutput"><span class="identifier">common_type</span></code>
+ of <code class="computeroutput"><span class="identifier">Rep1</span></code> and <code class="computeroutput"><span class="identifier">Rep2</span></code>. Both <code class="computeroutput"><span class="identifier">Rep1</span></code>
+ and <code class="computeroutput"><span class="identifier">Rep2</span></code> shall be implicitly
+ convertible to <code class="computeroutput"><span class="identifier">CR</span></code>, diagnostic
+ required.
+ </p>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">d</span>
+ <span class="special">*</span> <span class="identifier">s</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.duration_non_member_arithmetic.duration_operator_d_1"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_non_member_arithmetic.duration_operator_d_1" title="
+ Non-Member function operator/(duration,Rep2)">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">/(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">Rep2</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">&gt;</span>
+<span class="identifier">duration</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Rep2</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span> <span class="identifier">Period</span><span class="special">&gt;</span>
+<span class="keyword">operator</span><span class="special">/(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period</span><span class="special">&gt;&amp;</span> <span class="identifier">d</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Rep2</span><span class="special">&amp;</span> <span class="identifier">s</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Requires:</strong></span> Let <code class="computeroutput"><span class="identifier">CR</span></code>
+ represent the <code class="computeroutput"><span class="identifier">common_type</span></code>
+ of <code class="computeroutput"><span class="identifier">Rep1</span></code> and <code class="computeroutput"><span class="identifier">Rep2</span></code>. Both <code class="computeroutput"><span class="identifier">Rep1</span></code>
+ and <code class="computeroutput"><span class="identifier">Rep2</span></code> shall be implicitly
+ convertible to <code class="computeroutput"><span class="identifier">CR</span></code>, and
+ <code class="computeroutput"><span class="identifier">Rep2</span></code> shall not be an
+ instantiation of <code class="computeroutput"><span class="identifier">duration</span></code>,
+ diagnostic required.
+ </p>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">CR</span><span class="special">,</span> <span class="identifier">Period</span><span class="special">&gt;(</span><span class="identifier">d</span><span class="special">)</span> <span class="special">/=</span> <span class="identifier">s</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.duration_non_member_arithmetic.duration_operator_d_2"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_non_member_arithmetic.duration_operator_d_2" title="
+ Non-Member function operator/(duration,duration)">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">/(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+<span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Rep2</span><span class="special">&gt;::</span><span class="identifier">type</span>
+<span class="keyword">operator</span><span class="special">/(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> Let <code class="computeroutput"><span class="identifier">CD</span></code>
+ represent the <code class="computeroutput"><span class="identifier">common_type</span></code>
+ of the two <code class="computeroutput"><span class="identifier">duration</span></code> arguments.
+ Returns <code class="computeroutput"><span class="identifier">CD</span><span class="special">(</span><span class="identifier">lhs</span><span class="special">).</span><span class="identifier">count</span><span class="special">()</span> <span class="special">/</span> <span class="identifier">CD</span><span class="special">(</span><span class="identifier">rhs</span><span class="special">).</span><span class="identifier">count</span><span class="special">()</span></code>.
+ </p>
+</div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.reference.chrono_hpp.duration_comparaisons"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_comparaisons" title="duration
+ comparaisons">duration
+ comparaisons</a>
+</h4></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_comparaisons.duration_operator_eq_1">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">==(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_comparaisons.duration_operator_neq_1">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">!=(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_comparaisons.duration_operator_lt_1">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">&lt;(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_comparaisons.duration_operator_leq_1">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">&lt;=(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_comparaisons.duration_operator_gt_1">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">&gt;(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_comparaisons.duration_operator_gteq_1">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">&gt;=(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+</dl></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.duration_comparaisons.duration_operator_eq_1"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_comparaisons.duration_operator_eq_1" title="
+ Non-Member function operator==(duration,duration)">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">==(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">==(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> Let <code class="computeroutput"><span class="identifier">CD</span></code>
+ represent the <code class="computeroutput"><span class="identifier">common_type</span></code>
+ of the two <code class="computeroutput"><span class="identifier">duration</span></code> arguments.
+ Returns <code class="computeroutput"><span class="identifier">CD</span><span class="special">(</span><span class="identifier">lhs</span><span class="special">).</span><span class="identifier">count</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">CD</span><span class="special">(</span><span class="identifier">rhs</span><span class="special">).</span><span class="identifier">count</span><span class="special">()</span></code>
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.duration_comparaisons.duration_operator_neq_1"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_comparaisons.duration_operator_neq_1" title="
+ Non-Member function operator!=(duration,duration)">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">!=(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">!=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="special">!(</span><span class="identifier">lhs</span> <span class="special">==</span> <span class="identifier">rhs</span><span class="special">)</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.duration_comparaisons.duration_operator_lt_1"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_comparaisons.duration_operator_lt_1" title="
+ Non-Member function operator&lt;(duration,duration)">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">&lt;(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&lt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> Let <code class="computeroutput"><span class="identifier">CD</span></code>
+ represent the <code class="computeroutput"><span class="identifier">common_type</span></code>
+ of the two <code class="computeroutput"><span class="identifier">duration</span></code> arguments.
+ Returns <code class="computeroutput"><span class="identifier">CD</span><span class="special">(</span><span class="identifier">lhs</span><span class="special">).</span><span class="identifier">count</span><span class="special">()</span> <span class="special">&lt;</span> <span class="identifier">CD</span><span class="special">(</span><span class="identifier">rhs</span><span class="special">).</span><span class="identifier">count</span><span class="special">()</span></code>
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.duration_comparaisons.duration_operator_leq_1"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_comparaisons.duration_operator_leq_1" title="
+ Non-Member function operator&lt;=(duration,duration)">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">&lt;=(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&lt;=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="special">!(</span><span class="identifier">rhs</span> <span class="special">&lt;</span>
+ <span class="identifier">lhs</span><span class="special">)</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.duration_comparaisons.duration_operator_gt_1"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_comparaisons.duration_operator_gt_1" title="
+ Non-Member function operator&gt;(duration,duration)">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">&gt;(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&gt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">rhs</span>
+ <span class="special">&lt;</span> <span class="identifier">lhs</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.duration_comparaisons.duration_operator_gteq_1"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_comparaisons.duration_operator_gteq_1" title="
+ Non-Member function operator&gt;=(duration,duration)">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">&gt;=(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&gt;=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="special">!(</span><span class="identifier">lhs</span> <span class="special">&lt;</span>
+ <span class="identifier">rhs</span><span class="special">)</span></code>.
+ </p>
+</div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.reference.chrono_hpp.duration_cast"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.duration_cast" title=" Non-Member
+ function duration_cast(duration)"> Non-Member
+ function <code class="computeroutput"><span class="identifier">duration_cast</span><span class="special">(</span><span class="identifier">duration</span><span class="special">)</span></code></a>
+</h4></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">ToDuration</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period</span><span class="special">&gt;</span>
+<span class="identifier">ToDuration</span> <span class="identifier">duration_cast</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep</span><span class="special">,</span> <span class="identifier">Period</span><span class="special">&gt;&amp;</span> <span class="identifier">d</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Requires:</strong></span> <code class="computeroutput"><span class="identifier">ToDuration</span></code>
+ is an instantiation of <code class="computeroutput"><span class="identifier">duration</span></code>,
+ diagnostic required.
+ </p>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> Forms <code class="computeroutput"><span class="identifier">CF</span></code>
+ which is a <code class="computeroutput"><span class="identifier">ratio</span></code> resulting
+ from <code class="computeroutput"><span class="identifier">ratio_divide</span><span class="special">&lt;</span><span class="identifier">Period</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">ToDuration</span><span class="special">::</span><span class="identifier">period</span><span class="special">&gt;::</span><span class="identifier">type</span></code>.
+ Let <code class="computeroutput"><span class="identifier">CR</span></code> be the <code class="computeroutput"><span class="identifier">common_type</span></code> of <code class="computeroutput"><span class="identifier">ToDuration</span><span class="special">::</span><span class="identifier">rep</span></code>,
+ <code class="computeroutput"><span class="identifier">Rep</span></code>, and <code class="computeroutput"><span class="identifier">intmax_t</span></code>.
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ If <code class="computeroutput"><span class="identifier">CF</span><span class="special">::</span><span class="identifier">num</span> <span class="special">==</span> <span class="number">1</span></code> and <code class="computeroutput"><span class="identifier">CF</span><span class="special">::</span><span class="identifier">den</span> <span class="special">==</span> <span class="number">1</span></code>, then
+ returns <code class="computeroutput"><span class="identifier">ToDuration</span><span class="special">(</span><span class="keyword">static_cast</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">ToDuration</span><span class="special">::</span><span class="identifier">rep</span><span class="special">&gt;(</span><span class="identifier">d</span><span class="special">.</span><span class="identifier">count</span><span class="special">()))</span> </code>
+</li>
+<li>
+ else if <code class="computeroutput"><span class="identifier">CF</span><span class="special">::</span><span class="identifier">num</span> <span class="special">!=</span> <span class="number">1</span></code> and <code class="computeroutput"><span class="identifier">CF</span><span class="special">::</span><span class="identifier">den</span> <span class="special">==</span> <span class="number">1</span></code>, then
+ returns <code class="computeroutput"><span class="identifier">ToDuration</span><span class="special">(</span><span class="keyword">static_cast</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">ToDuration</span><span class="special">::</span><span class="identifier">rep</span><span class="special">&gt;(</span><span class="keyword">static_cast</span><span class="special">&lt;</span><span class="identifier">CR</span><span class="special">&gt;(</span><span class="identifier">d</span><span class="special">.</span><span class="identifier">count</span><span class="special">())</span> <span class="special">*</span> <span class="keyword">static_cast</span><span class="special">&lt;</span><span class="identifier">CR</span><span class="special">&gt;(</span><span class="identifier">CF</span><span class="special">::</span><span class="identifier">num</span><span class="special">)))</span></code>
+</li>
+<li>
+ else if <code class="computeroutput"><span class="identifier">CF</span><span class="special">::</span><span class="identifier">num</span> <span class="special">==</span> <span class="number">1</span></code> and <code class="computeroutput"><span class="identifier">CF</span><span class="special">::</span><span class="identifier">den</span> <span class="special">!=</span> <span class="number">1</span></code>, then
+ returns <code class="computeroutput"><span class="identifier">ToDuration</span><span class="special">(</span><span class="keyword">static_cast</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">ToDuration</span><span class="special">::</span><span class="identifier">rep</span><span class="special">&gt;(</span><span class="keyword">static_cast</span><span class="special">&lt;</span><span class="identifier">CR</span><span class="special">&gt;(</span><span class="identifier">d</span><span class="special">.</span><span class="identifier">count</span><span class="special">())</span> <span class="special">/</span> <span class="keyword">static_cast</span><span class="special">&lt;</span><span class="identifier">CR</span><span class="special">&gt;(</span><span class="identifier">CF</span><span class="special">::</span><span class="identifier">den</span><span class="special">)))</span></code>
+</li>
+<li>
+ else returns <code class="computeroutput"><span class="identifier">ToDuration</span><span class="special">(</span><span class="keyword">static_cast</span><span class="special">&lt;</span><span class="keyword">typename</span>
+ <span class="identifier">ToDuration</span><span class="special">::</span><span class="identifier">rep</span><span class="special">&gt;(</span><span class="keyword">static_cast</span><span class="special">&lt;</span><span class="identifier">CR</span><span class="special">&gt;(</span><span class="identifier">d</span><span class="special">.</span><span class="identifier">count</span><span class="special">())</span>
+ <span class="special">*</span> <span class="keyword">static_cast</span><span class="special">&lt;</span><span class="identifier">CR</span><span class="special">&gt;(</span><span class="identifier">CF</span><span class="special">::</span><span class="identifier">num</span><span class="special">)</span> <span class="special">/</span> <span class="keyword">static_cast</span><span class="special">&lt;</span><span class="identifier">CR</span><span class="special">&gt;(</span><span class="identifier">CF</span><span class="special">::</span><span class="identifier">den</span><span class="special">)))</span></code>
+</li>
+</ul></div>
+<p>
+ <span class="bold"><strong>Remarks:</strong></span> This function shall not rely
+ on any implicit conversions. All conversions shall be accomplished through
+ <code class="computeroutput"><span class="keyword">static_cast</span></code>. The implementation
+ shall avoid all multiplications or divisions when it is known at compile
+ time that it can be avoided because one or more arguments are <code class="computeroutput"><span class="number">1</span></code>. All intermediate computations shall be
+ carried out in the widest possible representation and only converted to
+ the destination representation at the final step.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__time_point_"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_" title="Class
+ template time_point">Class
+ template <code class="computeroutput"><span class="identifier">time_point</span></code></a>
+</h4></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_c_1">
+ Constructor <code class="computeroutput"><span class="identifier">time_point</span><span class="special">()</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_c_2">
+ Constructor <code class="computeroutput"><span class="identifier">time_point</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_c_3">
+ Constructor <code class="computeroutput"><span class="identifier">time_point</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_.time_since_epoch">
+ Member function <code class="computeroutput"><span class="identifier">time_since_epoch</span><span class="special">()</span> <span class="keyword">const</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_operator_pe">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">+=</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_operator_me">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">-=</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_min">
+ Static Member function <code class="computeroutput"><span class="identifier">min</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_max">
+ Static Member function <code class="computeroutput"><span class="identifier">max</span></code></a></span></dt>
+</dl></div>
+<p>
+ A <code class="computeroutput"><span class="identifier">time_point</span></code> represents
+ a point in time with respect to a specific clock.
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration</span><span class="special">&gt;</span>
+<span class="keyword">class</span> <span class="identifier">time_point</span> <span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="identifier">Clock</span> <span class="identifier">clock</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">Duration</span> <span class="identifier">duration</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">duration</span><span class="special">::</span><span class="identifier">rep</span> <span class="identifier">rep</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">duration</span><span class="special">::</span><span class="identifier">period</span> <span class="identifier">period</span><span class="special">;</span>
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="identifier">duration</span> <span class="identifier">d_</span><span class="special">;</span> <span class="comment">// exposition only
+</span><span class="keyword">public</span><span class="special">:</span>
+ <span class="identifier">time_point</span><span class="special">();</span>
+ <span class="keyword">explicit</span> <span class="identifier">time_point</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;</span> <span class="identifier">d</span><span class="special">);</span>
+
+ <span class="comment">// conversions
+</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Duration2</span><span class="special">&gt;</span>
+ <span class="identifier">time_point</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">clock</span><span class="special">,</span> <span class="identifier">Duration2</span><span class="special">&gt;&amp;</span> <span class="identifier">t</span><span class="special">,</span>
+ <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">enable_if</span>
+ <span class="special">&lt;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_convertible</span><span class="special">&lt;</span><span class="identifier">Duration2</span><span class="special">,</span> <span class="identifier">duration</span><span class="special">&gt;</span>
+ <span class="special">&gt;::</span><span class="identifier">type</span><span class="special">*</span> <span class="special">=</span> <span class="number">0</span><span class="special">);</span>
+
+ <span class="comment">// observer
+</span>
+ <span class="identifier">duration</span> <span class="identifier">time_since_epoch</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+
+ <span class="comment">// arithmetic
+</span>
+ <span class="identifier">time_point</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">+=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;</span> <span class="identifier">d</span><span class="special">);</span>
+ <span class="identifier">time_point</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">-=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;</span> <span class="identifier">d</span><span class="special">);</span>
+
+ <span class="comment">// special values
+</span>
+ <span class="keyword">static</span> <span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">time_point</span> <span class="identifier">min</span><span class="special">();</span>
+ <span class="keyword">static</span> <span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">time_point</span> <span class="identifier">max</span><span class="special">();</span>
+<span class="special">};</span>
+</pre>
+<p>
+ Clock shall meet the Clock Requirements.
+ </p>
+<p>
+ Duration shall be an instantiation of <code class="computeroutput"><span class="identifier">duration</span></code>,
+ diagnostic required.
+ </p>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_c_1"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_c_1" title="
+ Constructor time_point()">
+ Constructor <code class="computeroutput"><span class="identifier">time_point</span><span class="special">()</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="identifier">time_point</span><span class="special">();</span>
+</pre>
+<p>
+ <span class="bold"><strong>Effects:</strong></span> Constructs an object of <code class="computeroutput"><span class="identifier">time_point</span></code>, initializing <code class="computeroutput"><span class="identifier">d_</span></code> with <code class="computeroutput"><span class="identifier">duration</span><span class="special">::</span><span class="identifier">zero</span><span class="special">()</span></code>. This <code class="computeroutput"><span class="identifier">time_point</span></code>
+ represents the epoch.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_c_2"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_c_2" title="
+ Constructor time_point(const duration&amp;)">
+ Constructor <code class="computeroutput"><span class="identifier">time_point</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="identifier">time_point</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;</span> <span class="identifier">d</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Effects:</strong></span> Constructs an object of <code class="computeroutput"><span class="identifier">time_point</span></code>, initializing <code class="computeroutput"><span class="identifier">d_</span></code> with <code class="computeroutput"><span class="identifier">d</span></code>.
+ This <code class="computeroutput"><span class="identifier">time_point</span></code> represents
+ the epoch <code class="computeroutput"><span class="special">+</span> <span class="identifier">d</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_c_3"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_c_3" title="
+ Constructor time_point(const duration&amp;)">
+ Constructor <code class="computeroutput"><span class="identifier">time_point</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Duration2</span><span class="special">&gt;</span> <span class="identifier">time_point</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">clock</span><span class="special">,</span> <span class="identifier">Duration2</span><span class="special">&gt;&amp;</span> <span class="identifier">t</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Requires:</strong></span> <code class="computeroutput"><span class="identifier">Duration2</span></code>
+ shall be implicitly convertible to <code class="computeroutput"><span class="identifier">duration</span></code>,
+ diagnostic required.
+ </p>
+<p>
+ <span class="bold"><strong>Effects:</strong></span> Constructs an object of <code class="computeroutput"><span class="identifier">time_point</span></code>, initializing <code class="computeroutput"><span class="identifier">d_</span></code> with <code class="computeroutput"><span class="identifier">t</span><span class="special">.</span><span class="identifier">time_since_epoch</span><span class="special">()</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__time_point_.time_since_epoch"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_.time_since_epoch" title="
+ Member function time_since_epoch() const">
+ Member function <code class="computeroutput"><span class="identifier">time_since_epoch</span><span class="special">()</span> <span class="keyword">const</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="identifier">duration</span> <span class="identifier">time_since_epoch</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">d_</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_operator_pe"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_operator_pe" title="
+ Member function operator+=">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">+=</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="identifier">time_point</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">+=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;</span> <span class="identifier">d</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Effects:</strong></span> <code class="computeroutput"><span class="identifier">d_</span>
+ <span class="special">+=</span> <span class="identifier">d</span></code>.
+ </p>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_operator_me"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_operator_me" title="
+ Member function operator-=">
+ Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">-=</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="identifier">time_point</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">-=(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&amp;</span> <span class="identifier">d</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Effects:</strong></span> <code class="computeroutput"><span class="identifier">d_</span>
+ <span class="special">-=</span> <span class="identifier">d</span></code>
+ </p>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_min"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_min" title="
+ Static Member function min">
+ Static Member function <code class="computeroutput"><span class="identifier">min</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">static</span> <span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">time_point</span> <span class="identifier">min</span><span class="special">();</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">time_point</span><span class="special">(</span><span class="identifier">duration</span><span class="special">::</span><span class="identifier">min</span><span class="special">())</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_max"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class_template__time_point_.time_point_max" title="
+ Static Member function max">
+ Static Member function <code class="computeroutput"><span class="identifier">max</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">static</span> <span class="identifier">BOOST_CONSTEXPR</span> <span class="identifier">time_point</span> <span class="identifier">max</span><span class="special">();</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">time_point</span><span class="special">(</span><span class="identifier">duration</span><span class="special">::</span><span class="identifier">max</span><span class="special">())</span></code>.
+ </p>
+</div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.reference.chrono_hpp.time_point_non_member_arithmetic"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_non_member_arithmetic" title="time_point
+ non-member arithmetic">time_point
+ non-member arithmetic</a>
+</h4></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_non_member_arithmetic.time_point_operator_p_1">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">+(</span><span class="identifier">time_point</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_non_member_arithmetic.time_point_operator_p_2">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">+(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">time_point</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_non_member_arithmetic.time_point_operator_m_1">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">-(</span><span class="identifier">time_point</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_non_member_arithmetic.time_point_operator_m_2">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">-(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">time_point</span><span class="special">)</span></code></a></span></dt>
+</dl></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.time_point_non_member_arithmetic.time_point_operator_p_1"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_non_member_arithmetic.time_point_operator_p_1" title="
+ Non-Member function operator+(time_point,duration)">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">+(</span><span class="identifier">time_point</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+<span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">Duration1</span><span class="special">,</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;</span> <span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&gt;</span>
+<span class="keyword">operator</span><span class="special">+(</span><span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">CT</span><span class="special">(</span><span class="identifier">lhs</span><span class="special">)</span> <span class="special">+=</span> <span class="identifier">rhs</span></code> where <code class="computeroutput"><span class="identifier">CT</span></code>
+ is the type of the return value.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.time_point_non_member_arithmetic.time_point_operator_p_2"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_non_member_arithmetic.time_point_operator_p_2" title="
+ Non-Member function operator+(duration,time_point)">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">+(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">time_point</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Rep1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration2</span><span class="special">&gt;</span>
+<span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;,</span> <span class="identifier">Duration2</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&gt;</span>
+<span class="keyword">operator</span><span class="special">+(</span><span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep1</span><span class="special">,</span> <span class="identifier">Period1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">rhs</span>
+ <span class="special">+</span> <span class="identifier">lhs</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.time_point_non_member_arithmetic.time_point_operator_m_1"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_non_member_arithmetic.time_point_operator_m_1" title="
+ Non-Member function operator-(time_point,duration)">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">-(</span><span class="identifier">time_point</span><span class="special">,</span><span class="identifier">duration</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Rep2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period2</span><span class="special">&gt;</span>
+<span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">Duration1</span><span class="special">,</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;</span> <span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&gt;</span>
+<span class="keyword">operator</span><span class="special">-(</span><span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">duration</span><span class="special">&lt;</span><span class="identifier">Rep2</span><span class="special">,</span> <span class="identifier">Period2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">lhs</span>
+ <span class="special">+</span> <span class="special">(-</span><span class="identifier">rhs</span><span class="special">)</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.time_point_non_member_arithmetic.time_point_operator_m_2"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_non_member_arithmetic.time_point_operator_m_2" title="
+ Non-Member function operator-(duration,time_point)">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">-(</span><span class="identifier">duration</span><span class="special">,</span><span class="identifier">time_point</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration2</span><span class="special">&gt;</span>
+<span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">Duration1</span><span class="special">,</span> <span class="identifier">Duration2</span><span class="special">&gt;::</span><span class="identifier">type</span>
+<span class="keyword">operator</span><span class="special">-(</span><span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">lhs</span><span class="special">.</span><span class="identifier">time_since_epoch</span><span class="special">()</span> <span class="special">-</span> <span class="identifier">rhs</span><span class="special">.</span><span class="identifier">time_since_epoch</span><span class="special">()</span></code>.
+ </p>
+</div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.reference.chrono_hpp.time_point_comparisons"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_comparisons" title="time_point
+ comparisons">time_point
+ comparisons</a>
+</h4></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_operator_eq">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">==(</span><span class="identifier">time_point</span><span class="special">,</span><span class="identifier">time_point</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_operator_neq">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">!=(</span><span class="identifier">time_point</span><span class="special">,</span><span class="identifier">time_point</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_operator_lt">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">&lt;(</span><span class="identifier">time_point</span><span class="special">,</span><span class="identifier">time_point</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_operator_leq">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">&lt;=(</span><span class="identifier">time_point</span><span class="special">,</span><span class="identifier">time_point</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_operator_gt">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">&gt;(</span><span class="identifier">time_point</span><span class="special">,</span><span class="identifier">time_point</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_operator_geq">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">&gt;=(</span><span class="identifier">time_point</span><span class="special">,</span><span class="identifier">time_point</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_cast">
+ Non-Member function <code class="computeroutput"><span class="identifier">time_point_cast</span><span class="special">(</span><span class="identifier">time_point</span><span class="special">)</span></code></a></span></dt>
+</dl></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_operator_eq"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_operator_eq" title="
+ Non-Member function operator==(time_point,time_point)">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">==(</span><span class="identifier">time_point</span><span class="special">,</span><span class="identifier">time_point</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration2</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">==(</span><span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">lhs</span><span class="special">.</span><span class="identifier">time_since_epoch</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">rhs</span><span class="special">.</span><span class="identifier">time_since_epoch</span><span class="special">()</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_operator_neq"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_operator_neq" title="
+ Non-Member function operator!=(time_point,time_point)">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">!=(</span><span class="identifier">time_point</span><span class="special">,</span><span class="identifier">time_point</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<p>
+ template &lt;class Clock, class Duration1, class Duration2&gt; bool operator!=(const
+ time_point&lt;Clock, Duration1&gt;&amp; lhs, const time_point&lt;Clock,
+ Duration2&gt;&amp; rhs);
+ </p>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="special">!(</span><span class="identifier">lhs</span> <span class="special">==</span> <span class="identifier">rhs</span><span class="special">)</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_operator_lt"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_operator_lt" title="
+ Non-Member function operator&lt;(time_point,time_point)">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">&lt;(</span><span class="identifier">time_point</span><span class="special">,</span><span class="identifier">time_point</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration2</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&lt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> lhs.time_since_epoch() &lt;
+ rhs.time_since_epoch().
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_operator_leq"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_operator_leq" title="
+ Non-Member function operator&lt;=(time_point,time_point)">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">&lt;=(</span><span class="identifier">time_point</span><span class="special">,</span><span class="identifier">time_point</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration2</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&lt;=(</span><span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="special">!(</span><span class="identifier">rhs</span> <span class="special">&lt;</span>
+ <span class="identifier">lhs</span><span class="special">)</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_operator_gt"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_operator_gt" title="
+ Non-Member function operator&gt;(time_point,time_point)">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">&gt;(</span><span class="identifier">time_point</span><span class="special">,</span><span class="identifier">time_point</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<p>
+ template &lt;class Clock, class Duration1, class Duration2&gt; bool operator&gt;
+ (const time_point&lt;Clock, Duration1&gt;&amp; lhs, const time_point&lt;Clock,
+ Duration2&gt;&amp; rhs);
+ </p>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">rhs</span>
+ <span class="special">&lt;</span> <span class="identifier">lhs</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_operator_geq"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_operator_geq" title="
+ Non-Member function operator&gt;=(time_point,time_point)">
+ Non-Member function <code class="computeroutput"><span class="keyword">operator</span><span class="special">&gt;=(</span><span class="identifier">time_point</span><span class="special">,</span><span class="identifier">time_point</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration2</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&gt;=(</span><span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration1</span><span class="special">&gt;&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration2</span><span class="special">&gt;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="special">!(</span><span class="identifier">lhs</span> <span class="special">&lt;</span>
+ <span class="identifier">rhs</span><span class="special">)</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_cast"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.time_point_comparisons.time_point_cast" title="
+ Non-Member function time_point_cast(time_point)">
+ Non-Member function <code class="computeroutput"><span class="identifier">time_point_cast</span><span class="special">(</span><span class="identifier">time_point</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">ToDuration</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration</span><span class="special">&gt;</span>
+<span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">ToDuration</span><span class="special">&gt;</span> <span class="identifier">time_point_cast</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">Duration</span><span class="special">&gt;&amp;</span> <span class="identifier">t</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Requires:</strong></span> <code class="computeroutput"><span class="identifier">ToDuration</span></code>
+ is an instantiation of <code class="computeroutput"><span class="identifier">duration</span></code>,
+ diagnostic required.
+ </p>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">Clock</span><span class="special">,</span> <span class="identifier">ToDuration</span><span class="special">&gt;(</span><span class="identifier">duration_cast</span><span class="special">&lt;</span><span class="identifier">ToDuration</span><span class="special">&gt;(</span><span class="identifier">t</span><span class="special">.</span><span class="identifier">time_since_epoch</span><span class="special">()))</span></code>.
+ </p>
+</div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class__system_clock_"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class__system_clock_" title="Class
+ system_clock">Class
+ <code class="computeroutput"><span class="identifier">system_clock</span></code></a>
+</h4></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class__system_clock_.to_time_t">
+ Non-Member function <code class="computeroutput"><span class="identifier">to_time_t</span><span class="special">(</span><span class="identifier">time_point</span><span class="special">)</span></code></a></span></dt>
+<dt><span class="section"><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class__system_clock_.from_time_t">
+ Non-Member function <code class="computeroutput"><span class="identifier">from_time_t</span><span class="special">(</span><span class="identifier">time_t</span><span class="special">)</span></code></a></span></dt>
+</dl></div>
+<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">system_clock</span> <span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="identifier">BOOST_SYSTEM_CLOCK_DURATION</span> <span class="identifier">duration</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">duration</span><span class="special">::</span><span class="identifier">rep</span> <span class="identifier">rep</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">duration</span><span class="special">::</span><span class="identifier">period</span> <span class="identifier">period</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">chrono</span><span class="special">::</span><span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">system_clock</span><span class="special">&gt;</span> <span class="identifier">time_point</span><span class="special">;</span>
+ <span class="keyword">static</span> <span class="keyword">const</span> <span class="keyword">bool</span> <span class="identifier">is_monotonic</span> <span class="special">=</span> <span class="special">&lt;</span><span class="identifier">unspecified</span><span class="special">&gt;;</span>
+
+ <span class="keyword">static</span> <span class="identifier">time_point</span> <span class="identifier">now</span><span class="special">();</span> <span class="comment">// throws on error
+</span> <span class="keyword">static</span> <span class="identifier">time_point</span> <span class="identifier">now</span><span class="special">(</span><span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&amp;</span> <span class="identifier">ec</span><span class="special">);</span> <span class="comment">// never throws
+</span>
+ <span class="keyword">static</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">time_t</span> <span class="identifier">to_time_t</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">time_point</span><span class="special">&amp;</span> <span class="identifier">t</span><span class="special">);</span>
+ <span class="keyword">static</span> <span class="identifier">time_point</span> <span class="identifier">from_time_t</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">time_t</span> <span class="identifier">t</span><span class="special">);</span>
+<span class="special">};</span>
+</pre>
+<p>
+ <code class="computeroutput"><span class="identifier">system_clock</span><span class="special">::</span><span class="identifier">duration</span><span class="special">::</span><span class="identifier">min</span><span class="special">()</span> <span class="special">&lt;</span> <span class="identifier">system_clock</span><span class="special">::</span><span class="identifier">duration</span><span class="special">::</span><span class="identifier">zero</span><span class="special">()</span></code> shall be <code class="computeroutput"><span class="keyword">true</span></code>.
+ </p>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class__system_clock_.to_time_t"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class__system_clock_.to_time_t" title="
+ Non-Member function to_time_t(time_point)">
+ Non-Member function <code class="computeroutput"><span class="identifier">to_time_t</span><span class="special">(</span><span class="identifier">time_point</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<p>
+ time_t to_time_t(const time_point&amp; t);
+ </p>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> A <code class="computeroutput"><span class="identifier">time_t</span></code>
+ such that the <code class="computeroutput"><span class="identifier">time_t</span></code>
+ and <code class="computeroutput"><span class="identifier">t</span></code> represent the same
+ point in time, truncated to the courser of the precisions among <code class="computeroutput"><span class="identifier">time_t</span></code> and <code class="computeroutput"><span class="identifier">t</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class__system_clock_.from_time_t"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class__system_clock_.from_time_t" title="
+ Non-Member function from_time_t(time_t)">
+ Non-Member function <code class="computeroutput"><span class="identifier">from_time_t</span><span class="special">(</span><span class="identifier">time_t</span><span class="special">)</span></code></a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="identifier">time_point</span> <span class="identifier">from_time_t</span><span class="special">(</span><span class="identifier">time_t</span> <span class="identifier">t</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> A <code class="computeroutput"><span class="identifier">time_point</span></code>
+ such that the <code class="computeroutput"><span class="identifier">time_point</span></code>
+ and <code class="computeroutput"><span class="identifier">t</span></code> represent the same
+ point in time, truncated to the courser of the precisions among <code class="computeroutput"><span class="identifier">time_point</span></code> and <code class="computeroutput"><span class="identifier">t</span></code>.
+ </p>
+</div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class__monotonic_clock_"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class__monotonic_clock_" title="Class
+ monotonic_clock">Class
+ <code class="computeroutput"><span class="identifier">monotonic_clock</span></code></a>
+</h4></div></div></div>
+<p>
+ <code class="computeroutput"><span class="identifier">monotonic_clock</span></code> satisfy
+ the Clock Requirements.
+ </p>
+<pre class="programlisting"><span class="preprocessor">#ifdef</span> <span class="identifier">BOOST_HAS_CLOCK_MONOTONIC</span>
+ <span class="keyword">class</span> <span class="identifier">BOOST_CHRONO_DECL</span> <span class="identifier">monotonic_clock</span> <span class="special">{</span>
+ <span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="identifier">nanoseconds</span> <span class="identifier">duration</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">duration</span><span class="special">::</span><span class="identifier">rep</span> <span class="identifier">rep</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">duration</span><span class="special">::</span><span class="identifier">period</span> <span class="identifier">period</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">chrono</span><span class="special">::</span><span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">monotonic_clock</span><span class="special">&gt;</span> <span class="identifier">time_point</span><span class="special">;</span>
+ <span class="keyword">static</span> <span class="keyword">const</span> <span class="keyword">bool</span> <span class="identifier">is_monotonic</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span>
+
+ <span class="keyword">static</span> <span class="identifier">time_point</span> <span class="identifier">now</span><span class="special">();</span> <span class="comment">// throws on error
+</span> <span class="keyword">static</span> <span class="identifier">time_point</span> <span class="identifier">now</span><span class="special">(</span><span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&amp;</span> <span class="identifier">ec</span><span class="special">);</span> <span class="comment">// never throws
+</span> <span class="special">};</span>
+<span class="preprocessor">#endif</span>
+</pre>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.reference.chrono_hpp.class__high_resolution_clock_"></a><a href="chrono_hpp.html#boost_chrono.reference.chrono_hpp.class__high_resolution_clock_" title="Class
+ high_resolution_clock">Class
+ <code class="computeroutput"><span class="identifier">high_resolution_clock</span></code></a>
+</h4></div></div></div>
+<p>
+ <code class="computeroutput"><span class="identifier">high_resolution_clock</span></code> satisfy
+ the Clock Requirements.
+ </p>
+<pre class="programlisting"><span class="preprocessor">#ifdef</span> <span class="identifier">BOOST_CHRONO_HAS_CLOCK_MONOTONIC</span>
+ <span class="keyword">typedef</span> <span class="identifier">monotonic_clock</span> <span class="identifier">high_resolution_clock</span><span class="special">;</span> <span class="comment">// as permitted by [time.clock.hires]
+</span><span class="preprocessor">#else</span>
+ <span class="keyword">typedef</span> <span class="identifier">system_clock</span> <span class="identifier">high_resolution_clock</span><span class="special">;</span> <span class="comment">// as permitted by [time.clock.hires]
+</span><span class="preprocessor">#endif</span>
+</pre>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="ratio_hpp.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="timer_hpp.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/common_type_hpp.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/common_type_hpp.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,95 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title> Header &lt;boost/type_traits/common_type.hpp&gt;</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../../index.html" title="Boost.Chrono">
+<link rel="up" href="../reference.html" title="Reference">
+<link rel="prev" href="../reference.html" title="Reference">
+<link rel="next" href="ratio_hpp.html" title=" Header &lt;boost/ratio.hpp&gt;">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../reference.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="ratio_hpp.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_chrono.reference.common_type_hpp"></a> Header <boost/type_traits/common_type.hpp>
+</h3></div></div></div>
+<div class="toc"><dl><dt><span class="section"><a href="common_type_hpp.html#boost_chrono.reference.common_type_hpp.common_type">
+ Class Template <code class="computeroutput"><span class="identifier">common_type</span></code></a></span></dt></dl></div>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="special">...</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.reference.common_type_hpp.common_type"></a><a href="common_type_hpp.html#boost_chrono.reference.common_type_hpp.common_type" title="
+ Class Template common_type">
+ Class Template <code class="computeroutput"><span class="identifier">common_type</span></code></a>
+</h4></div></div></div>
+<p>
+ <code class="computeroutput"><span class="identifier">common_type</span></code> is a facility
+ which is useful in specifying the type of the result of functions and operators
+ which take a variety of types (e.g. "mixed mode" complex arithmetic).
+ </p>
+<p>
+ The nested typedef <code class="computeroutput"><span class="identifier">common_type</span><span class="special">::</span><span class="identifier">type</span></code>
+ shall be defined as follows:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U</span> <span class="special">=</span> <span class="keyword">void</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">V</span> <span class="special">=</span> <span class="keyword">void</span><span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">common_type</span> <span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span> <span class="identifier">V</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">type</span><span class="special">;</span>
+<span class="special">};</span>
+
+<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span> <span class="keyword">void</span><span class="special">,</span> <span class="keyword">void</span><span class="special">&gt;</span> <span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="identifier">T</span> <span class="identifier">type</span><span class="special">;</span>
+<span class="special">};</span>
+
+<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U</span><span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span><span class="special">,</span> <span class="keyword">void</span><span class="special">&gt;</span> <span class="special">{</span>
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="keyword">static</span> <span class="identifier">T</span> <span class="identifier">m_t</span><span class="special">();</span>
+ <span class="keyword">static</span> <span class="identifier">U</span> <span class="identifier">m_u</span><span class="special">();</span>
+ <span class="keyword">static</span> <span class="keyword">bool</span> <span class="identifier">m_f</span><span class="special">();</span> <span class="comment">// workaround gcc bug; not required by std
+</span><span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="identifier">BOOST_TYPEOF_TPL</span><span class="special">(</span><span class="identifier">m_f</span><span class="special">()</span> <span class="special">?</span> <span class="identifier">m_t</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">m_u</span><span class="special">())</span> <span class="identifier">type</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ All types in the parameter pack T shall be complete. This trait is permitted
+ to be specialized by a user if at least one template parameter is a user-defined
+ type.
+ </p>
+<p>
+ <span class="bold"><strong>Note:</strong></span> Such specializations are required
+ when only explicit conversions are desired among the <code class="computeroutput"><span class="identifier">common_type</span></code>
+ arguments.
+ </p>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../reference.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="ratio_hpp.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/process_times_hpp.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/process_times_hpp.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,119 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title> Header &lt;boost/chrono/process_times.hpp&gt;</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../../index.html" title="Boost.Chrono">
+<link rel="up" href="../reference.html" title="Reference">
+<link rel="prev" href="timer_hpp.html" title=" Header &lt;boost/chrono/timer.hpp&gt;">
+<link rel="next" href="../examples.html" title="Examples">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="timer_hpp.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../examples.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_chrono.reference.process_times_hpp"></a> Header <boost/chrono/process_times.hpp>
+</h3></div></div></div>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">chrono</span> <span class="special">{</span>
+
+ <span class="keyword">struct</span> <span class="identifier">process_times</span><span class="special">;</span>
+
+ <span class="keyword">class</span> <span class="identifier">process_clock</span> <span class="special">{</span>
+ <span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="identifier">nanoseconds</span> <span class="identifier">duration</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">duration</span><span class="special">::</span><span class="identifier">rep</span> <span class="identifier">rep</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">duration</span><span class="special">::</span><span class="identifier">period</span> <span class="identifier">period</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">chrono</span><span class="special">::</span><span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">process_clock</span><span class="special">&gt;</span> <span class="identifier">time_point</span><span class="special">;</span>
+ <span class="keyword">static</span> <span class="keyword">const</span> <span class="keyword">bool</span> <span class="identifier">is_monotonic</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span>
+
+ <span class="keyword">static</span> <span class="keyword">void</span> <span class="identifier">now</span><span class="special">(</span> <span class="identifier">process_times</span> <span class="special">&amp;</span> <span class="identifier">times</span><span class="special">,</span>
+ <span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&amp;</span> <span class="identifier">ec</span> <span class="special">=</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">throws</span> <span class="special">);</span>
+ <span class="special">};</span>
+
+ <span class="keyword">struct</span> <span class="identifier">process_times</span> <span class="special">{</span>
+ <span class="identifier">process_clock</span><span class="special">::</span><span class="identifier">duration</span> <span class="identifier">real</span><span class="special">;</span> <span class="comment">// real (i.e wall clock) time
+</span> <span class="identifier">process_clock</span><span class="special">::</span><span class="identifier">duration</span> <span class="identifier">user</span><span class="special">;</span> <span class="comment">// user cpu time
+</span> <span class="identifier">process_clock</span><span class="special">::</span><span class="identifier">duration</span> <span class="identifier">system</span><span class="special">;</span> <span class="comment">// system cpu time
+</span> <span class="special">};</span>
+
+ <span class="keyword">class</span> <span class="identifier">process_timer</span> <span class="special">{</span>
+ <span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="identifier">process_clock</span> <span class="identifier">clock</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">process_clock</span><span class="special">::</span><span class="identifier">duration</span> <span class="identifier">duration</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">process_clock</span><span class="special">::</span><span class="identifier">time_point</span> <span class="identifier">time_point</span><span class="special">;</span>
+
+ <span class="keyword">explicit</span> <span class="identifier">process_timer</span><span class="special">(</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&amp;</span> <span class="identifier">ec</span> <span class="special">=</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">throws</span> <span class="special">);</span>
+
+ <span class="special">~</span><span class="identifier">process_timer</span><span class="special">();</span>
+ <span class="keyword">void</span> <span class="identifier">start</span><span class="special">(</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&amp;</span> <span class="identifier">ec</span> <span class="special">=</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">throws</span> <span class="special">);</span>
+ <span class="keyword">void</span> <span class="identifier">elapsed</span><span class="special">(</span> <span class="identifier">process_times</span> <span class="special">&amp;</span> <span class="identifier">times</span><span class="special">,</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&amp;</span> <span class="identifier">ec</span> <span class="special">=</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">throws</span> <span class="special">);</span>
+ <span class="special">};</span>
+
+ <span class="keyword">class</span> <span class="identifier">run_timer</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">process_timer</span> <span class="special">{</span>
+ <span class="keyword">public</span><span class="special">:</span>
+
+ <span class="keyword">explicit</span> <span class="identifier">run_timer</span><span class="special">(</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&amp;</span> <span class="identifier">ec</span> <span class="special">=</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">throws</span> <span class="special">);</span>
+ <span class="keyword">explicit</span> <span class="identifier">run_timer</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span> <span class="special">&amp;</span> <span class="identifier">os</span><span class="special">,</span>
+ <span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&amp;</span> <span class="identifier">ec</span> <span class="special">=</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">throws</span> <span class="special">);</span>
+
+ <span class="keyword">explicit</span> <span class="identifier">run_timer</span><span class="special">(</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span> <span class="identifier">format</span><span class="special">,</span>
+ <span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&amp;</span> <span class="identifier">ec</span> <span class="special">=</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">throws</span> <span class="special">);</span>
+ <span class="keyword">explicit</span> <span class="identifier">run_timer</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span> <span class="special">&amp;</span> <span class="identifier">os</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span> <span class="identifier">format</span><span class="special">,</span>
+ <span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&amp;</span> <span class="identifier">ec</span> <span class="special">=</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">throws</span> <span class="special">);</span>
+
+ <span class="keyword">explicit</span> <span class="identifier">run_timer</span><span class="special">(</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span> <span class="identifier">format</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">places</span><span class="special">,</span>
+ <span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&amp;</span> <span class="identifier">ec</span> <span class="special">=</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">throws</span> <span class="special">);</span>
+ <span class="keyword">explicit</span> <span class="identifier">run_timer</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span> <span class="special">&amp;</span> <span class="identifier">os</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span> <span class="identifier">format</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">places</span><span class="special">,</span>
+ <span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&amp;</span> <span class="identifier">ec</span> <span class="special">=</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">throws</span> <span class="special">);</span>
+
+ <span class="keyword">explicit</span> <span class="identifier">run_timer</span><span class="special">(</span> <span class="keyword">int</span> <span class="identifier">places</span><span class="special">,</span>
+ <span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&amp;</span> <span class="identifier">ec</span> <span class="special">=</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">throws</span> <span class="special">);</span>
+ <span class="keyword">explicit</span> <span class="identifier">run_timer</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span> <span class="special">&amp;</span> <span class="identifier">os</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">places</span><span class="special">,</span>
+ <span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&amp;</span> <span class="identifier">ec</span> <span class="special">=</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">throws</span> <span class="special">);</span>
+
+ <span class="keyword">explicit</span> <span class="identifier">run_timer</span><span class="special">(</span> <span class="keyword">int</span> <span class="identifier">places</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span> <span class="identifier">format</span><span class="special">,</span>
+ <span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&amp;</span> <span class="identifier">ec</span> <span class="special">=</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">throws</span> <span class="special">);</span>
+ <span class="keyword">explicit</span> <span class="identifier">run_timer</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span> <span class="special">&amp;</span> <span class="identifier">os</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">places</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span> <span class="identifier">format</span><span class="special">,</span>
+ <span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&amp;</span> <span class="identifier">ec</span> <span class="special">=</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">throws</span> <span class="special">);</span>
+
+ <span class="special">~</span><span class="identifier">run_timer</span><span class="special">();</span>
+
+ <span class="keyword">void</span> <span class="identifier">start</span><span class="special">(</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&amp;</span> <span class="identifier">ec</span> <span class="special">=</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">throws</span> <span class="special">);</span>
+
+ <span class="keyword">void</span> <span class="identifier">report</span><span class="special">(</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&amp;</span> <span class="identifier">ec</span> <span class="special">=</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">throws</span> <span class="special">);</span>
+
+ <span class="keyword">void</span> <span class="identifier">test_report</span><span class="special">(</span> <span class="identifier">duration</span> <span class="identifier">real_</span><span class="special">,</span> <span class="identifier">duration</span> <span class="identifier">user_</span><span class="special">,</span> <span class="identifier">duration</span> <span class="identifier">system_</span> <span class="special">);</span>
+ <span class="keyword">bool</span> <span class="identifier">reported</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+ <span class="keyword">static</span> <span class="keyword">int</span> <span class="identifier">default_places</span><span class="special">();</span>
+ <span class="special">};</span>
+
+ <span class="special">}</span> <span class="comment">// namespace chrono
+</span><span class="special">}</span> <span class="comment">// namespace boost
+</span></pre>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="timer_hpp.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../examples.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/ratio_hpp.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/ratio_hpp.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,321 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title> Header &lt;boost/ratio.hpp&gt;</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../../index.html" title="Boost.Chrono">
+<link rel="up" href="../reference.html" title="Reference">
+<link rel="prev" href="common_type_hpp.html" title=" Header &lt;boost/type_traits/common_type.hpp&gt;">
+<link rel="next" href="chrono_hpp.html" title=" Header &lt;boost/chrono.hpp&gt;">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="common_type_hpp.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="chrono_hpp.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_chrono.reference.ratio_hpp"></a> Header <boost/ratio.hpp>
+</h3></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="ratio_hpp.html#boost_chrono.reference.ratio_hpp.ratio"> Class Template
+ <code class="computeroutput"><span class="identifier">ratio</span><span class="special">&lt;&gt;</span></code></a></span></dt>
+<dd><dl><dt><span class="section"><a href="ratio_hpp.html#boost_chrono.reference.ratio_hpp.ratio.construction_and_assignment">Construction
+ and assignment</a></span></dt></dl></dd>
+<dt><span class="section"><a href="ratio_hpp.html#boost_chrono.reference.ratio_hpp.ratio_arithmetic">
+ <code class="computeroutput"><span class="identifier">ratio</span></code> arithmetic</a></span></dt>
+<dt><span class="section"><a href="ratio_hpp.html#boost_chrono.reference.ratio_hpp.ratio_comparison">
+ <code class="computeroutput"><span class="identifier">ratio</span></code> comparison</a></span></dt>
+<dt><span class="section"><a href="ratio_hpp.html#boost_chrono.reference.ratio_hpp.ration_SI_typedefs">
+ SI typedefs</a></span></dt>
+</dl></div>
+<p>
+ <code class="computeroutput"><span class="identifier">ratio</span></code> is a facility which
+ is useful in specifying compile time rational constants. Compile time rational
+ arithmetic is supported with protection against overflow and divide by zero.
+ Such a facility is very handy when needing to efficiently represent 1/3 of
+ a nanosecond, or specifying an inch in terms of meters (for example 254/10000
+ meters - which <code class="computeroutput"><span class="identifier">ratio</span></code> will
+ reduce to 127/5000 meters).
+ </p>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">intmax_t</span> <span class="identifier">N</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">intmax_t</span> <span class="identifier">D</span> <span class="special">=</span> <span class="number">1</span><span class="special">&gt;</span> <span class="keyword">class</span> <span class="identifier">ratio</span><span class="special">;</span>
+
+ <span class="comment">// ratio arithmetic
+</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R2</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">ratio_add</span><span class="special">;</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R2</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">ratio_subtract</span><span class="special">;</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R2</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">ratio_multiply</span><span class="special">;</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R2</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">ratio_divide</span><span class="special">;</span>
+
+ <span class="comment">// ratio comparison
+</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R2</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">ratio_equal</span><span class="special">;</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R2</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">ratio_not_equal</span><span class="special">;</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R2</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">ratio_less</span><span class="special">;</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R2</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">ratio_less_equal</span><span class="special">;</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R2</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">ratio_greater</span><span class="special">;</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R2</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">ratio_greater_equal</span><span class="special">;</span>
+
+ <span class="comment">// convenience SI typedefs
+</span> <span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">1LL</span><span class="special">,</span> <span class="number">1000000000000000000LL</span><span class="special">&gt;</span> <span class="identifier">atto</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">1LL</span><span class="special">,</span> <span class="number">1000000000000000LL</span><span class="special">&gt;</span> <span class="identifier">femto</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">1LL</span><span class="special">,</span> <span class="number">1000000000000LL</span><span class="special">&gt;</span> <span class="identifier">pico</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">1LL</span><span class="special">,</span> <span class="number">1000000000LL</span><span class="special">&gt;</span> <span class="identifier">nano</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">1LL</span><span class="special">,</span> <span class="number">1000000LL</span><span class="special">&gt;</span> <span class="identifier">micro</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">1LL</span><span class="special">,</span> <span class="number">1000LL</span><span class="special">&gt;</span> <span class="identifier">milli</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">1LL</span><span class="special">,</span> <span class="number">100LL</span><span class="special">&gt;</span> <span class="identifier">centi</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">1LL</span><span class="special">,</span> <span class="number">10LL</span><span class="special">&gt;</span> <span class="identifier">deci</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span> <span class="number">10LL</span><span class="special">,</span> <span class="number">1LL</span><span class="special">&gt;</span> <span class="identifier">deca</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span> <span class="number">100LL</span><span class="special">,</span> <span class="number">1LL</span><span class="special">&gt;</span> <span class="identifier">hecto</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span> <span class="number">1000LL</span><span class="special">,</span> <span class="number">1LL</span><span class="special">&gt;</span> <span class="identifier">kilo</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span> <span class="number">1000000LL</span><span class="special">,</span> <span class="number">1LL</span><span class="special">&gt;</span> <span class="identifier">mega</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span> <span class="number">1000000000LL</span><span class="special">,</span> <span class="number">1LL</span><span class="special">&gt;</span> <span class="identifier">giga</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span> <span class="number">1000000000000LL</span><span class="special">,</span> <span class="number">1LL</span><span class="special">&gt;</span> <span class="identifier">tera</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span> <span class="number">1000000000000000LL</span><span class="special">,</span> <span class="number">1LL</span><span class="special">&gt;</span> <span class="identifier">peta</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">1000000000000000000LL</span><span class="special">,</span> <span class="number">1LL</span><span class="special">&gt;</span> <span class="identifier">exa</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.reference.ratio_hpp.ratio"></a><a href="ratio_hpp.html#boost_chrono.reference.ratio_hpp.ratio" title=" Class Template
+ ratio&lt;&gt;"> Class Template
+ <code class="computeroutput"><span class="identifier">ratio</span><span class="special">&lt;&gt;</span></code></a>
+</h4></div></div></div>
+<div class="toc"><dl><dt><span class="section"><a href="ratio_hpp.html#boost_chrono.reference.ratio_hpp.ratio.construction_and_assignment">Construction
+ and assignment</a></span></dt></dl></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">intmax_t</span> <span class="identifier">N</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">intmax_t</span> <span class="identifier">D</span><span class="special">&gt;</span>
+<span class="keyword">class</span> <span class="identifier">ratio</span> <span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">intmax_t</span> <span class="identifier">num</span><span class="special">;</span>
+ <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">intmax_t</span> <span class="identifier">den</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="identifier">num</span><span class="special">,</span> <span class="identifier">den</span><span class="special">&gt;</span> <span class="identifier">type</span><span class="special">;</span>
+
+ <span class="identifier">ratio</span><span class="special">()</span> <span class="special">{}</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="identifier">intmax_t</span> <span class="identifier">_N2</span><span class="special">,</span> <span class="identifier">intmax_t</span> <span class="identifier">_D2</span><span class="special">&gt;</span>
+ <span class="identifier">ratio</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="identifier">_N2</span><span class="special">,</span> <span class="identifier">_D2</span><span class="special">&gt;&amp;,</span>
+ <span class="keyword">typename</span> <span class="identifier">enable_if_c</span>
+ <span class="special">&lt;</span>
+ <span class="identifier">ratio</span><span class="special">&lt;</span><span class="identifier">_N2</span><span class="special">,</span> <span class="identifier">_D2</span><span class="special">&gt;::</span><span class="identifier">num</span> <span class="special">==</span> <span class="identifier">num</span> <span class="special">&amp;&amp;</span>
+ <span class="identifier">ratio</span><span class="special">&lt;</span><span class="identifier">_N2</span><span class="special">,</span> <span class="identifier">_D2</span><span class="special">&gt;::</span><span class="identifier">den</span> <span class="special">==</span> <span class="identifier">den</span>
+ <span class="special">&gt;::</span><span class="identifier">type</span><span class="special">*</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span> <span class="special">{}</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="identifier">intmax_t</span> <span class="identifier">_N2</span><span class="special">,</span> <span class="identifier">intmax_t</span> <span class="identifier">_D2</span><span class="special">&gt;</span>
+ <span class="keyword">typename</span> <span class="identifier">enable_if_c</span>
+ <span class="special">&lt;</span>
+ <span class="identifier">ratio</span><span class="special">&lt;</span><span class="identifier">_N2</span><span class="special">,</span> <span class="identifier">_D2</span><span class="special">&gt;::</span><span class="identifier">num</span> <span class="special">==</span> <span class="identifier">num</span> <span class="special">&amp;&amp;</span>
+ <span class="identifier">ratio</span><span class="special">&lt;</span><span class="identifier">_N2</span><span class="special">,</span> <span class="identifier">_D2</span><span class="special">&gt;::</span><span class="identifier">den</span> <span class="special">==</span> <span class="identifier">den</span><span class="special">,</span>
+ <span class="identifier">ratio</span><span class="special">&amp;</span>
+ <span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="identifier">_N2</span><span class="special">,</span> <span class="identifier">_D2</span><span class="special">&gt;&amp;)</span> <span class="special">{</span><span class="keyword">return</span> <span class="special">*</span><span class="keyword">this</span><span class="special">;}</span>
+<span class="special">};</span>
+</pre>
+<p>
+ A diagnostic shall be emitted if <code class="computeroutput"><span class="identifier">ratio</span></code>
+ is instantiated with <code class="computeroutput"><span class="identifier">D</span> <span class="special">==</span> <span class="number">0</span></code>, or
+ if the absolute value of <code class="computeroutput"><span class="identifier">N</span></code>
+ or <code class="computeroutput"><span class="identifier">D</span></code> can not be represented.
+ <span class="bold"><strong>Note:</strong></span> These rules ensure that infinite
+ ratios are avoided and that for any negative input, there exists a representable
+ value of its absolute value which is positive. In a two's complement representation,
+ this excludes the most negative value.
+ </p>
+<p>
+ Let <code class="computeroutput"><span class="identifier">gcd</span></code> denote the greatest
+ common divisor of <code class="computeroutput"><span class="identifier">N</span></code>'s absolute
+ value and of <code class="computeroutput"><span class="identifier">D</span></code>'s absolute
+ value.
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<code class="computeroutput"><span class="identifier">num</span></code> shall have the value
+ <code class="computeroutput"><span class="identifier">sign</span><span class="special">(</span><span class="identifier">N</span><span class="special">)*</span><span class="identifier">sign</span><span class="special">(</span><span class="identifier">D</span><span class="special">)*</span><span class="identifier">abs</span><span class="special">(</span><span class="identifier">N</span><span class="special">)/</span><span class="identifier">gcd</span></code>.
+ </li>
+<li>
+<code class="computeroutput"><span class="identifier">den</span></code> shall have the value
+ <code class="computeroutput"><span class="identifier">abs</span><span class="special">(</span><span class="identifier">D</span><span class="special">)/</span><span class="identifier">gcd</span></code>.
+ </li>
+</ul></div>
+<p>
+ The nested typedef <code class="computeroutput"><span class="identifier">type</span></code>
+ denotes the normalized form of this ratio type. It should be used when
+ the template parameters don't give a normalized form.
+ </p>
+<p>
+ Two <code class="computeroutput"><span class="identifier">ratio</span></code> classes <code class="computeroutput"><span class="identifier">ratio</span><span class="special">&lt;</span><span class="identifier">N1</span><span class="special">,</span><span class="identifier">D1</span><span class="special">&gt;</span></code> and <code class="computeroutput"><span class="identifier">ratio</span><span class="special">&lt;</span><span class="identifier">N2</span><span class="special">,</span><span class="identifier">D2</span><span class="special">&gt;</span></code>
+ have the same normalized form if <code class="computeroutput"><span class="identifier">ratio</span><span class="special">&lt;</span><span class="identifier">N1</span><span class="special">,</span><span class="identifier">D1</span><span class="special">&gt;::</span><span class="identifier">type</span></code> is the same type as <code class="computeroutput"><span class="identifier">ratio</span><span class="special">&lt;</span><span class="identifier">N2</span><span class="special">,</span><span class="identifier">D2</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
+ </p>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_chrono.reference.ratio_hpp.ratio.construction_and_assignment"></a><a href="ratio_hpp.html#boost_chrono.reference.ratio_hpp.ratio.construction_and_assignment" title="Construction
+ and assignment">Construction
+ and assignment</a>
+</h5></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="identifier">intmax_t</span> <span class="identifier">N2</span><span class="special">,</span> <span class="identifier">intmax_t</span> <span class="identifier">D2</span><span class="special">&gt;</span>
+ <span class="identifier">ratio</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="identifier">N2</span><span class="special">,</span> <span class="identifier">D2</span><span class="special">&gt;&amp;</span> <span class="identifier">r</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Effects:</strong></span> Constructs a <code class="computeroutput"><span class="identifier">ratio</span></code> object.
+ </p>
+<p>
+ <span class="bold"><strong>Remarks:</strong></span> This constructor shall not
+ participate in overload resolution unless <code class="computeroutput"><span class="identifier">r</span></code>
+ has the same normalized form as <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="identifier">intmax_t</span> <span class="identifier">N2</span><span class="special">,</span> <span class="identifier">intmax_t</span> <span class="identifier">D2</span><span class="special">&gt;</span>
+ <span class="identifier">ratio</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="identifier">N2</span><span class="special">,</span> <span class="identifier">D2</span><span class="special">&gt;&amp;</span> <span class="identifier">r</span><span class="special">);</span>
+</pre>
+<p>
+ <span class="bold"><strong>Effects:</strong></span> Assigns a <code class="computeroutput"><span class="identifier">ratio</span></code>
+ object.
+ </p>
+<p>
+ <span class="bold"><strong>Returns:</strong></span> *this.
+ </p>
+<p>
+ <span class="bold"><strong>Remarks:</strong></span> This operator shall not participate
+ in overload resolution unless <code class="computeroutput"><span class="identifier">r</span></code>
+ has the same normalized form as <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </p>
+</div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.reference.ratio_hpp.ratio_arithmetic"></a><a href="ratio_hpp.html#boost_chrono.reference.ratio_hpp.ratio_arithmetic" title="
+ ratio arithmetic">
+ <code class="computeroutput"><span class="identifier">ratio</span></code> arithmetic</a>
+</h4></div></div></div>
+<p>
+ For each of the class templates in this clause, each template parameter
+ shall refer to a <code class="computeroutput"><span class="identifier">ratio</span></code>.
+ If the implementation is unable to form the indicated <code class="computeroutput"><span class="identifier">ratio</span></code>
+ due to overflow, a diagnostic shall be issued.
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R2</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">ratio_add</span> <span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="special">[/</span><span class="identifier">see</span> <span class="identifier">below</span><span class="special">]</span> <span class="identifier">type</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ The nested typedef <code class="computeroutput"><span class="identifier">type</span></code>
+ shall be a synonym for <code class="computeroutput"><span class="identifier">ratio</span><span class="special">&lt;</span><span class="identifier">R1</span><span class="special">::</span><span class="identifier">num</span> <span class="special">*</span> <span class="identifier">R2</span><span class="special">::</span><span class="identifier">den</span> <span class="special">+</span> <span class="identifier">R2</span><span class="special">::</span><span class="identifier">num</span> <span class="special">*</span> <span class="identifier">R1</span><span class="special">::</span><span class="identifier">den</span><span class="special">,</span> <span class="identifier">R1</span><span class="special">::</span><span class="identifier">den</span> <span class="special">*</span> <span class="identifier">R2</span><span class="special">::</span><span class="identifier">den</span><span class="special">&gt;::</span><span class="identifier">type</span></code>.
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R2</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">ratio_subtract</span> <span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="special">[/</span><span class="identifier">see</span> <span class="identifier">below</span><span class="special">]</span> <span class="identifier">type</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ The nested typedef <code class="computeroutput"><span class="identifier">type</span></code>
+ shall be a synonym for <code class="computeroutput"><span class="identifier">ratio</span><span class="special">&lt;</span><span class="identifier">R1</span><span class="special">::</span><span class="identifier">num</span> <span class="special">*</span> <span class="identifier">R2</span><span class="special">::</span><span class="identifier">den</span> <span class="special">-</span> <span class="identifier">R2</span><span class="special">::</span><span class="identifier">num</span> <span class="special">*</span> <span class="identifier">R1</span><span class="special">::</span><span class="identifier">den</span><span class="special">,</span> <span class="identifier">R1</span><span class="special">::</span><span class="identifier">den</span> <span class="special">*</span> <span class="identifier">R2</span><span class="special">::</span><span class="identifier">den</span><span class="special">&gt;::</span><span class="identifier">type</span></code>.
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R2</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">ratio_multiply</span> <span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="special">[/</span><span class="identifier">see</span> <span class="identifier">below</span><span class="special">]</span> <span class="identifier">type</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ The nested typedef <code class="computeroutput"><span class="identifier">type</span></code>
+ shall be a synonym for <code class="computeroutput"><span class="identifier">ratio</span><span class="special">&lt;</span><span class="identifier">R1</span><span class="special">::</span><span class="identifier">num</span> <span class="special">*</span> <span class="identifier">R2</span><span class="special">::</span><span class="identifier">num</span><span class="special">,</span> <span class="identifier">R1</span><span class="special">::</span><span class="identifier">den</span> <span class="special">*</span> <span class="identifier">R2</span><span class="special">::</span><span class="identifier">den</span><span class="special">&gt;::</span><span class="identifier">type</span></code>.
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R2</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">ratio_divide</span> <span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="special">[/</span><span class="identifier">see</span> <span class="identifier">below</span><span class="special">]</span> <span class="identifier">type</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ The nested typedef <code class="computeroutput"><span class="identifier">type</span></code>
+ shall be a synonym for <code class="computeroutput"><span class="identifier">ratio</span><span class="special">&lt;</span><span class="identifier">R1</span><span class="special">::</span><span class="identifier">num</span> <span class="special">*</span> <span class="identifier">R2</span><span class="special">::</span><span class="identifier">den</span><span class="special">,</span> <span class="identifier">R2</span><span class="special">::</span><span class="identifier">num</span> <span class="special">*</span> <span class="identifier">R1</span><span class="special">::</span><span class="identifier">den</span><span class="special">&gt;::</span><span class="identifier">type</span></code>.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.reference.ratio_hpp.ratio_comparison"></a><a href="ratio_hpp.html#boost_chrono.reference.ratio_hpp.ratio_comparison" title="
+ ratio comparison">
+ <code class="computeroutput"><span class="identifier">ratio</span></code> comparison</a>
+</h4></div></div></div>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R2</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">ratio_equal</span>
+ <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">bool</span><span class="special">,</span> <span class="special">[/</span><span class="identifier">see</span> <span class="identifier">below</span><span class="special">]</span> <span class="special">&gt;</span> <span class="special">{};</span>
+</pre>
+<p>
+ If R1::num <code class="literal">= R2::num &amp;&amp; R1::den =</code> R2::den, ratio_equal
+ derives from true_type, else derives from false_type.
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R2</span><span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">ratio_less</span>
+ <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">bool</span><span class="special">,</span> <span class="special">[/</span><span class="identifier">see</span> <span class="identifier">below</span><span class="special">]</span> <span class="special">&gt;</span> <span class="special">{};</span>
+</pre>
+<p>
+ If R1::num * R2::den &lt; R2::num * R1::den, ratio_less derives from true_type,
+ else derives from false_type. Implementations are permitted to use more
+ complex algorithms to compute the above relationship to avoid overflow.
+ If the implementation is not able to avoid overflow, a diagnostic shall
+ be emitted.
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R2</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">ratio_not_equal</span>
+ <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">bool</span><span class="special">,</span> <span class="special">!</span><span class="identifier">ratio_equal</span><span class="special">&lt;</span><span class="identifier">R1</span><span class="special">,</span> <span class="identifier">R2</span><span class="special">&gt;::</span><span class="identifier">value</span><span class="special">&gt;</span> <span class="special">{};</span>
+
+<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R2</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">ratio_less_equal</span>
+ <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">bool</span><span class="special">,</span> <span class="special">!</span><span class="identifier">ratio_less</span><span class="special">&lt;</span><span class="identifier">R2</span><span class="special">,</span> <span class="identifier">R1</span><span class="special">&gt;::</span><span class="identifier">value</span><span class="special">&gt;</span> <span class="special">{};</span>
+
+<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R2</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">ratio_greater</span>
+ <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">bool</span><span class="special">,</span> <span class="identifier">ratio_less</span><span class="special">&lt;</span><span class="identifier">R2</span><span class="special">,</span> <span class="identifier">R1</span><span class="special">&gt;::</span><span class="identifier">value</span><span class="special">&gt;</span> <span class="special">{};</span>
+
+<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R2</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">ratio_greater_equal</span>
+ <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">integral_constant</span><span class="special">&lt;</span><span class="keyword">bool</span><span class="special">,</span> <span class="special">!</span><span class="identifier">ratio_less</span><span class="special">&lt;</span><span class="identifier">R1</span><span class="special">,</span> <span class="identifier">R2</span><span class="special">&gt;::</span><span class="identifier">value</span><span class="special">&gt;</span> <span class="special">{};</span>
+</pre>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.reference.ratio_hpp.ration_SI_typedefs"></a><a href="ratio_hpp.html#boost_chrono.reference.ratio_hpp.ration_SI_typedefs" title="
+ SI typedefs">
+ SI typedefs</a>
+</h4></div></div></div>
+<pre class="programlisting"><span class="comment">// convenience SI typedefs
+</span><span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">1LL</span><span class="special">,</span> <span class="number">1000000000000000000LL</span><span class="special">&gt;</span> <span class="identifier">atto</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">1LL</span><span class="special">,</span> <span class="number">1000000000000000LL</span><span class="special">&gt;</span> <span class="identifier">femto</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">1LL</span><span class="special">,</span> <span class="number">1000000000000LL</span><span class="special">&gt;</span> <span class="identifier">pico</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">1LL</span><span class="special">,</span> <span class="number">1000000000LL</span><span class="special">&gt;</span> <span class="identifier">nano</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">1LL</span><span class="special">,</span> <span class="number">1000000LL</span><span class="special">&gt;</span> <span class="identifier">micro</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">1LL</span><span class="special">,</span> <span class="number">1000LL</span><span class="special">&gt;</span> <span class="identifier">milli</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">1LL</span><span class="special">,</span> <span class="number">100LL</span><span class="special">&gt;</span> <span class="identifier">centi</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">1LL</span><span class="special">,</span> <span class="number">10LL</span><span class="special">&gt;</span> <span class="identifier">deci</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span> <span class="number">10LL</span><span class="special">,</span> <span class="number">1LL</span><span class="special">&gt;</span> <span class="identifier">deca</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span> <span class="number">100LL</span><span class="special">,</span> <span class="number">1LL</span><span class="special">&gt;</span> <span class="identifier">hecto</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span> <span class="number">1000LL</span><span class="special">,</span> <span class="number">1LL</span><span class="special">&gt;</span> <span class="identifier">kilo</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span> <span class="number">1000000LL</span><span class="special">,</span> <span class="number">1LL</span><span class="special">&gt;</span> <span class="identifier">mega</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span> <span class="number">1000000000LL</span><span class="special">,</span> <span class="number">1LL</span><span class="special">&gt;</span> <span class="identifier">giga</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span> <span class="number">1000000000000LL</span><span class="special">,</span> <span class="number">1LL</span><span class="special">&gt;</span> <span class="identifier">tera</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span> <span class="number">1000000000000000LL</span><span class="special">,</span> <span class="number">1LL</span><span class="special">&gt;</span> <span class="identifier">peta</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">1000000000000000000LL</span><span class="special">,</span> <span class="number">1LL</span><span class="special">&gt;</span> <span class="identifier">exa</span><span class="special">;</span>
+</pre>
+<p>
+ Four of the typedefs in the recomendation which can be conditionally supported
+ are not supported: yocto, zepto, zetta and yotta.
+ </p>
+<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">1</span><span class="special">,</span> <span class="number">1000000000000000000000000</span><span class="special">&gt;</span> <span class="identifier">yocto</span><span class="special">;</span> <span class="comment">// conditionally supported
+</span><span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">1</span><span class="special">,</span> <span class="number">1000000000000000000000</span><span class="special">&gt;</span> <span class="identifier">zepto</span><span class="special">;</span> <span class="comment">// conditionally supported
+</span><span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span> <span class="number">1000000000000000000000</span><span class="special">,</span> <span class="number">1</span><span class="special">&gt;</span> <span class="identifier">zetta</span><span class="special">;</span> <span class="comment">// conditionally supported
+</span><span class="keyword">typedef</span> <span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">1000000000000000000000000</span><span class="special">,</span> <span class="number">1</span><span class="special">&gt;</span> <span class="identifier">yotta</span><span class="special">;</span> <span class="comment">// conditionally supported
+</span></pre>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="common_type_hpp.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="chrono_hpp.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/timer_hpp.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/timer_hpp.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,68 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title> Header &lt;boost/chrono/timer.hpp&gt;</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../../index.html" title="Boost.Chrono">
+<link rel="up" href="../reference.html" title="Reference">
+<link rel="prev" href="chrono_hpp.html" title=" Header &lt;boost/chrono.hpp&gt;">
+<link rel="next" href="process_times_hpp.html" title=" Header &lt;boost/chrono/process_times.hpp&gt;">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="chrono_hpp.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="process_times_hpp.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_chrono.reference.timer_hpp"></a> Header <boost/chrono/timer.hpp>
+</h3></div></div></div>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">chrono</span> <span class="special">{</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Clock</span><span class="special">&gt;</span> <span class="keyword">class</span> <span class="identifier">timer</span> <span class="special">{</span>
+ <span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="identifier">Clock</span> <span class="identifier">clock</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">Clock</span><span class="special">::</span><span class="identifier">duration</span> <span class="identifier">duration</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">Clock</span><span class="special">::</span><span class="identifier">time_point</span> <span class="identifier">time_point</span><span class="special">;</span>
+
+ <span class="keyword">explicit</span> <span class="identifier">timer</span><span class="special">(</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&amp;</span> <span class="identifier">ec</span> <span class="special">=</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">throws</span> <span class="special">);</span>
+
+ <span class="special">~</span><span class="identifier">timer</span><span class="special">();</span>
+
+ <span class="keyword">void</span> <span class="identifier">start</span><span class="special">(</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&amp;</span> <span class="identifier">ec</span> <span class="special">=</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">throws</span> <span class="special">);</span>
+ <span class="identifier">duration</span> <span class="identifier">elapsed</span><span class="special">(</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&amp;</span> <span class="identifier">ec</span> <span class="special">=</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">throws</span> <span class="special">);</span>
+
+ <span class="special">};</span>
+
+ <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">chrono</span><span class="special">::</span><span class="identifier">timer</span><span class="special">&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">chrono</span><span class="special">::</span><span class="identifier">system_clock</span> <span class="special">&gt;</span> <span class="identifier">system_timer</span><span class="special">;</span>
+<span class="preprocessor">#ifdef</span> <span class="identifier">BOOST_CHRONO_HAS_CLOCK_MONOTONIC</span>
+ <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">chrono</span><span class="special">::</span><span class="identifier">timer</span><span class="special">&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">chrono</span><span class="special">::</span><span class="identifier">monotonic_clock</span> <span class="special">&gt;</span> <span class="identifier">monotonic_timer</span><span class="special">;</span>
+<span class="preprocessor">#endif</span>
+ <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">chrono</span><span class="special">::</span><span class="identifier">timer</span><span class="special">&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">chrono</span><span class="special">::</span><span class="identifier">high_resolution_clock</span> <span class="special">&gt;</span> <span class="identifier">high_resolution_timer</span><span class="special">;</span>
+
+<span class="special">}</span> <span class="special">}</span>
+</pre>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="chrono_hpp.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="process_times_hpp.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/users_guide.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/users_guide.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,54 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title> Users'Guide</title>
+<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../index.html" title="Boost.Chrono">
+<link rel="up" href="../index.html" title="Boost.Chrono">
+<link rel="prev" href="overview/motivation.html" title="Motivation">
+<link rel="next" href="users_guide/getting_started.html" title=" Getting Started">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="overview/motivation.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="users_guide/getting_started.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_chrono.users_guide"></a> Users'Guide
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"> Getting Started</span></dt>
+<dd><dl>
+<dt><span class="section"><a href="users_guide/getting_started.html#boost_chrono.users_guide.getting_started.install">
+ Installing Chrono</a></span></dt>
+<dt><span class="section"><a href="users_guide/getting_started.html#boost_chrono.users_guide.getting_started.hello_world__">Hello
+ World! </a></span></dt>
+</dl></dd>
+<dt><span class="section">Tutorial</span></dt>
+<dt><span class="section"> References</span></dt>
+</dl></div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="overview/motivation.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="users_guide/getting_started.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/users_guide/ext_references.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/users_guide/ext_references.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,60 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title> References</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../../index.html" title="Boost.Chrono">
+<link rel="up" href="../users_guide.html" title=" Users'Guide">
+<link rel="prev" href="tutorial.html" title="Tutorial">
+<link rel="next" href="../reference.html" title="Reference">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../users_guide.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../reference.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_chrono.users_guide.ext_references"></a> References
+</h3></div></div></div>
+<div class="variablelist">
+<p class="title"><b></b></p>
+<dl>
+<dt><span class="term">C++ Standards Committee's current Working Paper</span></dt>
+<dd><p>
+ The most authoritative reference material for the library is the C++
+ Standards Committee's current Working Paper (WP). 20.9 Time utilities
+ "time", 20.4 Compile-time rational arithmetic "ratio",
+ 20.6.7 Other transformations "meta.trans.other"
+ </p></dd>
+<dt><span class="term">N2661 - A Foundation to Sleep On</span></dt>
+<dd><p>
+ From Howard E. Hinnant, Walter E. Brown, Jeff Garland and Marc Paterno.
+ Is very informative and provides motivation for key design decisions
+ </p></dd>
+</dl>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../users_guide.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../reference.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/users_guide/getting_started.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/users_guide/getting_started.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,238 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title> Getting Started</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../../index.html" title="Boost.Chrono">
+<link rel="up" href="../users_guide.html" title=" Users'Guide">
+<link rel="prev" href="../users_guide.html" title=" Users'Guide">
+<link rel="next" href="tutorial.html" title="Tutorial">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../users_guide.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../users_guide.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="tutorial.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_chrono.users_guide.getting_started"></a> Getting Started
+</h3></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="getting_started.html#boost_chrono.users_guide.getting_started.install">
+ Installing Chrono</a></span></dt>
+<dt><span class="section"><a href="getting_started.html#boost_chrono.users_guide.getting_started.hello_world__">Hello
+ World! </a></span></dt>
+</dl></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.users_guide.getting_started.install"></a><a href="getting_started.html#boost_chrono.users_guide.getting_started.install" title="
+ Installing Chrono">
+ Installing Chrono</a>
+</h4></div></div></div>
+<a name="boost_chrono.users_guide.getting_started.install.getting_boost_chrono"></a><h5>
+<a name="id4816001"></a>
+ <a href="getting_started.html#boost_chrono.users_guide.getting_started.install.getting_boost_chrono">Getting
+ Boost.Chrono</a>
+ </h5>
+<p>
+ You can get the last stable release of Boost.Chrono by downloading <code class="literal">chrono.zip</code>
+ from the <a href="http://www.boost-consulting.com/vault/index.php?directory=System" target="_top">Boost
+ Vault</a>
+ </p>
+<p>
+ You can also access the latest (unstable?) state from the <a href="https://svn.boost.org/svn/boost/sandbox/chrono" target="_top">Boost
+ Sandbox</a>.
+ </p>
+<a name="boost_chrono.users_guide.getting_started.install.building_boost_chrono"></a><h5>
+<a name="id4816049"></a>
+ <a href="getting_started.html#boost_chrono.users_guide.getting_started.install.building_boost_chrono">Building
+ Boost.Chrono</a>
+ </h5>
+<p>
+ __Boost<span class="underline">Chono</span>_ is not a header only
+ library. You need to compile it before use.
+ </p>
+<pre class="programlisting"><span class="identifier">bjam</span> <span class="identifier">libs</span><span class="special">/</span><span class="identifier">chrono</span><span class="special">/</span><span class="identifier">build</span>
+</pre>
+<a name="boost_chrono.users_guide.getting_started.install.requirements"></a><h5>
+<a name="id4816111"></a>
+ Requirements
+ </h5>
+<p>
+ <span class="bold"><strong>Boost.Bitfield</strong></span> depends on some Boost libraries.
+ For these specific parts you must use either Boost version 1.39.0 or the
+ version in SVN trunk (even if older version should works also).
+ </p>
+<p>
+ In particular, Boost.Chrono depends on:
+ </p>
+<div class="variablelist">
+<p class="title"><b></b></p>
+<dl>
+<dt><span class="term">Boost.Config</span></dt>
+<dd><p>
+ for configuration purposes, ...
+ </p></dd>
+<dt><span class="term">Boost.Exception</span></dt>
+<dd><p>
+ for throw_exception, ...
+ </p></dd>
+<dt><span class="term">Boost.System</span></dt>
+<dd><p>
+ for error_code, ...
+ </p></dd>
+<dt><span class="term">Boost.TypeTraits</span></dt>
+<dd><p>
+ for ..., ...
+ </p></dd>
+<dt><span class="term">Boost.Typeof</span></dt>
+<dd><p>
+ for typeof, ...
+ </p></dd>
+<dt><span class="term">Boost.UtiliTy/EnableIf</span></dt>
+<dd><p>
+ for enable_if, ...
+ </p></dd>
+</dl>
+</div>
+<a name="boost_chrono.users_guide.getting_started.install.exceptions_safety"></a><h5>
+<a name="id4816269"></a>
+ <a href="getting_started.html#boost_chrono.users_guide.getting_started.install.exceptions_safety">Exceptions
+ safety</a>
+ </h5>
+<p>
+ All functions in the library are exception-neutral and provide strong guarantee
+ of exception safety as long as the underlying parameters provide it.
+ </p>
+<a name="boost_chrono.users_guide.getting_started.install.thread_safety"></a><h5>
+<a name="id4816295"></a>
+ <a href="getting_started.html#boost_chrono.users_guide.getting_started.install.thread_safety">Thread
+ safety</a>
+ </h5>
+<p>
+ All functions in the library are thread-unsafe except when noted explicitly.
+ </p>
+<a name="boost_chrono.users_guide.getting_started.install.tested_compilers"></a><h5>
+<a name="id4816320"></a>
+ <a href="getting_started.html#boost_chrono.users_guide.getting_started.install.tested_compilers">Tested
+ compilers</a>
+ </h5>
+<p>
+ The implementation will eventually work with most C++03 conforming compilers.
+ Initial tests have been run on
+ </p>
+<p>
+ Windows with
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ VC++ 9.0 SP1
+ </li>
+<li>
+ Intel 11.0
+ </li>
+</ul></div>
+<p>
+ On Ubuntu Linux with
+ </p>
+<div class="itemizedlist"><ul type="disc"><li>
+ GCC 4.2.4
+ </li></ul></div>
+<p>
+ On SL Linux with
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ GCC 3.4.6
+ </li>
+<li>
+ GCC 4.1.2
+ </li>
+</ul></div>
+<p>
+ On Cygwin with
+ </p>
+<div class="itemizedlist"><ul type="disc"><li>
+ GCC 3.4.4
+ </li></ul></div>
+<div class="note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../doc/html/images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ Please send any questions, comments and bug reports to boost &lt;at&gt;
+ lists &lt;dot&gt; boost &lt;dot&gt; org.
+ </p></td></tr>
+</table></div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.users_guide.getting_started.hello_world__"></a><a href="getting_started.html#boost_chrono.users_guide.getting_started.hello_world__" title="Hello
+ World! ">Hello
+ World! </a>
+</h4></div></div></div>
+<p>
+ If all you want to do is to time a program's execution:
+ </p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">chrono</span><span class="special">/</span><span class="identifier">process_times</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+<span class="special">...</span>
+
+<span class="comment">// add this in the scope you want to time,
+</span><span class="comment">// at the point you want the timer to start.
+</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">chrono</span><span class="special">::</span><span class="identifier">run_timer</span> <span class="identifier">rt</span><span class="special">;</span>
+</pre>
+<p>
+ Here is a complete program (run_timer_example.cpp):
+ </p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">chrono</span><span class="special">/</span><span class="identifier">process_times</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">cmath</span><span class="special">&gt;</span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">chrono</span><span class="special">::</span><span class="identifier">run_timer</span> <span class="identifier">t</span><span class="special">;</span>
+
+ <span class="keyword">for</span> <span class="special">(</span> <span class="keyword">long</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special">&lt;</span> <span class="number">10000000</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span> <span class="special">)</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">sqrt</span><span class="special">(</span> <span class="number">123.456L</span> <span class="special">);</span> <span class="comment">// burn some time
+</span>
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ Debug build output was:
+ </p>
+<pre class="programlisting"><span class="identifier">real</span> <span class="number">0.832</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">cpu</span> <span class="number">0.813</span><span class="identifier">s</span> <span class="special">(</span><span class="number">97.7</span><span class="special">%),</span> <span class="identifier">user</span> <span class="number">0.813</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">system</span> <span class="number">0.000</span><span class="identifier">s</span>
+</pre>
+<p>
+ In other words, the program took 0.832 real-time (i.e. wall clock) seconds
+ to execute, while the operating system (Windows in this case) charged 0.813
+ seconds of CPU time to the user and 0 seconds to the system. The total
+ CPU time reported was 0.813 seconds, and that represented utilization of
+ 97.7% of the real-time seconds.
+ </p>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../users_guide.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../users_guide.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="tutorial.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/users_guide/tutorial.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/users_guide/tutorial.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Tutorial</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="../../index.html" title="Boost.Chrono">
+<link rel="up" href="../users_guide.html" title=" Users'Guide">
+<link rel="prev" href="getting_started.html" title=" Getting Started">
+<link rel="next" href="ext_references.html" title=" References">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="getting_started.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../users_guide.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="ext_references.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title">
+<a name="boost_chrono.users_guide.tutorial"></a>Tutorial
+</h3></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 Howard Hinnant<br>Copyright © 2006 , 2008 Beman Dawes<br>Copyright © 2009 Vicente J. Botet Escriba<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="getting_started.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../users_guide.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="ext_references.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/index.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/index.html 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,120 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Boost.Chrono</title>
+<link rel="stylesheet" href="../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
+<link rel="start" href="index.html" title="Boost.Chrono">
+<link rel="next" href="boost_chrono/overview.html" title="Overview">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav"><a accesskey="n" href="boost_chrono/overview.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a></div>
+<div class="article" lang="en">
+<div class="titlepage">
+<div>
+<div><h2 class="title">
+<a name="boost_chrono"></a>Boost.Chrono</h2></div>
+<div><div class="authorgroup">
+<div class="author"><h3 class="author">
+<span class="firstname">Howard</span> <span class="surname">Hinnant</span>
+</h3></div>
+<div class="author"><h3 class="author">
+<span class="firstname">Beman</span> <span class="surname">Dawes</span>
+</h3></div>
+<div class="author"><h3 class="author">
+<span class="firstname">Vicente J.</span> <span class="surname">Botet Escriba</span>
+</h3></div>
+</div></div>
+<div><p class="copyright">Copyright © 2008 Howard Hinnant</p></div>
+<div><p class="copyright">Copyright © 2006 , 2008 Beman Dawes</p></div>
+<div><p class="copyright">Copyright © 2009 Vicente J. Botet Escriba</p></div>
+<div><div class="legalnotice">
+<a name="id4803141"></a><p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></div>
+</div>
+<hr>
+</div>
+<div class="toc">
+<p><b>Table of Contents</b></p>
+<dl>
+<dt><span class="section">Overview</span></dt>
+<dd><dl><dt><span class="section">Motivation</span></dt></dl></dd>
+<dt><span class="section"> Users'Guide</span></dt>
+<dd><dl>
+<dt><span class="section"> Getting Started</span></dt>
+<dt><span class="section">Tutorial</span></dt>
+<dt><span class="section"> References</span></dt>
+</dl></dd>
+<dt><span class="section">Reference</span></dt>
+<dd><dl>
+<dt><span class="section"> Header <boost/type_traits/common_type.hpp></span></dt>
+<dt><span class="section"> Header <boost/ratio.hpp></span></dt>
+<dt><span class="section"> Header <boost/chrono.hpp></span></dt>
+<dt><span class="section"> Header <boost/chrono/timer.hpp></span></dt>
+<dt><span class="section"> Header <boost/chrono/process_times.hpp></span></dt>
+</dl></dd>
+<dt><span class="section">Examples</span></dt>
+<dd><dl>
+<dt><span class="section">SI-units</span></dt>
+<dt><span class="section"><a href="boost_chrono/examples/how_you_override_the_duration_s_default_constructor.html">How
+ you override the duration's default constructor</a></span></dt>
+<dt><span class="section">min utility</span></dt>
+<dt><span class="section">Cycle count</span></dt>
+<dt><span class="section">xtime_clock</span></dt>
+<dt><span class="section">runtime_resolution</span></dt>
+<dt><span class="section"><a href="boost_chrono/examples/simulated_thread_interface_demonstration_program.html">Simulated
+ thread interface demonstration program</a></span></dt>
+<dt><span class="section">saturating</span></dt>
+<dt><span class="section"><a href="boost_chrono/examples/howard_hinnant_s_original_demonstration_program.html">Howard
+ Hinnant's original demonstration program</a></span></dt>
+<dt><span class="section"><a href="boost_chrono/examples/a_tiny_program_that_times_how_long_until_a_key_is_struck.html">A
+ tiny program that times how long until a key is struck</a></span></dt>
+<dt><span class="section">run_timer_example.cpp</span></dt>
+<dt><span class="section">run_timer_example2.cpp</span></dt>
+</dl></dd>
+<dt><span class="section">Appendices</span></dt>
+<dd><dl>
+<dt><span class="section"> Appendix A: History</span></dt>
+<dt><span class="section"> Appendix B: Rationale</span></dt>
+<dt><span class="section"><a href="boost_chrono/appendices/implementation.html"> Appendix C:
+ Implementation Notes</a></span></dt>
+<dt><span class="section"><a href="boost_chrono/appendices/acknowledgements.html"> Appendix D:
+ Acknowledgements</a></span></dt>
+<dt><span class="section"><a href="boost_chrono/appendices/appendix_e__tests.html">Appendix E:
+ Tests</a></span></dt>
+<dt><span class="section"><a href="boost_chrono/appendices/appendix_f__tickets.html">Appendix
+ F: Tickets</a></span></dt>
+<dt><span class="section"> Appendix F: Future plans</span></dt>
+</dl></dd>
+</dl>
+</div>
+<div class="warning"><table border="0" summary="Warning">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../../doc/html/images/warning.png"></td>
+<th align="left">Warning</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ Chrono is not part of the Boost libraries.
+ </p></td></tr>
+</table></div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"><p><small>Last revised: December 08, 2009 at 12:46:15 GMT</small></p></td>
+<td align="right"><div class="copyright-footer"></div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"><a accesskey="n" href="boost_chrono/overview.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a></div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/standalone_HTML.manifest
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/standalone_HTML.manifest 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,34 @@
+index.html
+boost_chrono/overview.html
+boost_chrono/overview/motivation.html
+boost_chrono/users_guide.html
+boost_chrono/users_guide/getting_started.html
+boost_chrono/users_guide/tutorial.html
+boost_chrono/users_guide/ext_references.html
+boost_chrono/reference.html
+boost_chrono/reference/common_type_hpp.html
+boost_chrono/reference/ratio_hpp.html
+boost_chrono/reference/chrono_hpp.html
+boost_chrono/reference/timer_hpp.html
+boost_chrono/reference/process_times_hpp.html
+boost_chrono/examples.html
+boost_chrono/examples/si_units.html
+boost_chrono/examples/how_you_override_the_duration_s_default_constructor.html
+boost_chrono/examples/min_utility.html
+boost_chrono/examples/cycle_count.html
+boost_chrono/examples/xtime_clock.html
+boost_chrono/examples/runtime_resolution.html
+boost_chrono/examples/simulated_thread_interface_demonstration_program.html
+boost_chrono/examples/saturating.html
+boost_chrono/examples/howard_hinnant_s_original_demonstration_program.html
+boost_chrono/examples/a_tiny_program_that_times_how_long_until_a_key_is_struck.html
+boost_chrono/examples/run_timer_example_cpp.html
+boost_chrono/examples/run_timer_example2_cpp.html
+boost_chrono/appendices.html
+boost_chrono/appendices/history.html
+boost_chrono/appendices/rationale.html
+boost_chrono/appendices/implementation.html
+boost_chrono/appendices/acknowledgements.html
+boost_chrono/appendices/appendix_e__tests.html
+boost_chrono/appendices/appendix_f__tickets.html
+boost_chrono/appendices/todo.html

Added: sandbox/chrono/libs/chrono/example/cycle_count.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/example/cycle_count.cpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,143 @@
+// cycle_count.cpp ----------------------------------------------------------//
+
+// Copyright 2008 Howard Hinnant
+// Copyright 2008 Beman Dawes
+// Copyright 2009 Vicente J. Botet Escriba
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+/*
+This code was extracted by Vicente J. Botet Escriba from Beman Dawes time2_demo.cpp which
+was derived by Beman Dawes from Howard Hinnant's time2_demo prototype.
+Many thanks to Howard for making his code available under the Boost license.
+The original code was modified to conform to Boost conventions and to section
+20.9 Time utilities [time] of the C++ committee's working paper N2798.
+See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf.
+
+time2_demo contained this comment:
+
+ Much thanks to Andrei Alexandrescu,
+ Walter Brown,
+ Peter Dimov,
+ Jeff Garland,
+ Terry Golubiewski,
+ Daniel Krügler,
+ Anthony Williams.
+*/
+
+#include <boost/chrono/chrono.hpp>
+#include <boost/type_traits.hpp>
+
+#include <iostream>
+
+#undef min
+#undef max
+
+using namespace boost::chrono;
+
+
+template <long long speed>
+struct cycle_count
+{
+ typedef typename boost::ratio_multiply<boost::ratio<speed>, boost::mega>::type frequency; // Mhz
+ typedef typename boost::ratio_divide<boost::ratio<1>, frequency>::type period;
+ typedef long long rep;
+ typedef boost::chrono::duration<rep, period> duration;
+ typedef boost::chrono::time_point<cycle_count> time_point;
+
+ static time_point now()
+ {
+ static long long tick = 0;
+ // return exact cycle count
+ return time_point(duration(++tick)); // fake access to clock cycle count
+ }
+};
+
+template <long long speed>
+struct approx_cycle_count
+{
+ static const long long frequency = speed * 1000000; // MHz
+ typedef nanoseconds duration;
+ typedef duration::rep rep;
+ typedef duration::period period;
+ static const long long nanosec_per_sec = period::den;
+ typedef boost::chrono::time_point<approx_cycle_count> time_point;
+
+ static time_point now()
+ {
+ static long long tick = 0;
+ // return cycle count as an approximate number of nanoseconds
+ // compute as if nanoseconds is only duration in the std::lib
+ return time_point(duration(++tick * nanosec_per_sec / frequency));
+ }
+};
+
+void cycle_count_delay()
+{
+ {
+ typedef cycle_count<400> clock;
+ std::cout << "\nSimulated " << clock::frequency::num / boost::mega::num << "MHz clock which has a tick period of "
+ << duration<double, boost::nano>(clock::duration(1)).count() << " nanoseconds\n";
+ nanoseconds delayns(500);
+ clock::duration delay = duration_cast<clock::duration>(delayns);
+ std::cout << "delay = " << delayns.count() << " nanoseconds which is " << delay.count() << " cycles\n";
+ clock::time_point start = clock::now();
+ clock::time_point stop = start + delay;
+ while (clock::now() < stop) // no multiplies or divides in this loop
+ ;
+ clock::time_point end = clock::now();
+ clock::duration elapsed = end - start;
+ std::cout << "paused " << elapsed.count() << " cycles ";
+ std::cout << "which is " << duration_cast<nanoseconds>(elapsed).count() << " nanoseconds\n";
+ }
+ {
+ typedef approx_cycle_count<400> clock;
+ std::cout << "\nSimulated " << clock::frequency / 1000000 << "MHz clock modeled with nanoseconds\n";
+ clock::duration delay = nanoseconds(500);
+ std::cout << "delay = " << delay.count() << " nanoseconds\n";
+ clock::time_point start = clock::now();
+ clock::time_point stop = start + delay;
+ while (clock::now() < stop) // 1 multiplication and 1 division in this loop
+ ;
+ clock::time_point end = clock::now();
+ clock::duration elapsed = end - start;
+ std::cout << "paused " << elapsed.count() << " nanoseconds\n";
+ }
+ {
+ typedef cycle_count<1500> clock;
+ std::cout << "\nSimulated " << clock::frequency::num / boost::mega::num << "MHz clock which has a tick period of "
+ << duration<double, boost::nano>(clock::duration(1)).count() << " nanoseconds\n";
+ nanoseconds delayns(500);
+ clock::duration delay = duration_cast<clock::duration>(delayns);
+ std::cout << "delay = " << delayns.count() << " nanoseconds which is " << delay.count() << " cycles\n";
+ clock::time_point start = clock::now();
+ clock::time_point stop = start + delay;
+ while (clock::now() < stop) // no multiplies or divides in this loop
+ ;
+ clock::time_point end = clock::now();
+ clock::duration elapsed = end - start;
+ std::cout << "paused " << elapsed.count() << " cycles ";
+ std::cout << "which is " << duration_cast<nanoseconds>(elapsed).count() << " nanoseconds\n";
+ }
+ {
+ typedef approx_cycle_count<1500> clock;
+ std::cout << "\nSimulated " << clock::frequency / 1000000 << "MHz clock modeled with nanoseconds\n";
+ clock::duration delay = nanoseconds(500);
+ std::cout << "delay = " << delay.count() << " nanoseconds\n";
+ clock::time_point start = clock::now();
+ clock::time_point stop = start + delay;
+ while (clock::now() < stop) // 1 multiplication and 1 division in this loop
+ ;
+ clock::time_point end = clock::now();
+ clock::duration elapsed = end - start;
+ std::cout << "paused " << elapsed.count() << " nanoseconds\n";
+ }
+}
+
+int main()
+{
+ cycle_count_delay();
+ return 0;
+}
+

Added: sandbox/chrono/libs/chrono/example/i_dont_like_the_default_duration_behavior.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/example/i_dont_like_the_default_duration_behavior.cpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,101 @@
+// i_dont_like_the_default_duration_behavior.cpp ----------------------------------------------------------//
+
+// Copyright 2008 Howard Hinnant
+// Copyright 2008 Beman Dawes
+// Copyright 2009 Vicente J. Botet Escriba
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+/*
+This code was extracted by Vicente J. Botet Escriba from Beman Dawes time2_demo.cpp which
+was derived by Beman Dawes from Howard Hinnant's time2_demo prototype.
+Many thanks to Howard for making his code available under the Boost license.
+The original code was modified to conform to Boost conventions and to section
+20.9 Time utilities [time] of the C++ committee's working paper N2798.
+See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf.
+
+time2_demo contained this comment:
+
+ Much thanks to Andrei Alexandrescu,
+ Walter Brown,
+ Peter Dimov,
+ Jeff Garland,
+ Terry Golubiewski,
+ Daniel Krügler,
+ Anthony Williams.
+*/
+
+#include <boost/chrono/chrono.hpp>
+#include <boost/type_traits.hpp>
+
+#include <iostream>
+
+#undef min
+#undef max
+
+
+namespace I_dont_like_the_default_duration_behavior
+{
+
+// Here's how you override the duration's default constructor to do anything you want (in this case zero)
+
+template <class R>
+class zero_default
+{
+public:
+ typedef R rep;
+
+private:
+ rep rep_;
+public:
+ zero_default(rep i = 0) : rep_(i) {}
+ operator rep() const {return rep_;}
+
+ zero_default& operator+=(zero_default x) {rep_ += x.rep_; return *this;}
+ zero_default& operator-=(zero_default x) {rep_ -= x.rep_; return *this;}
+ zero_default& operator*=(zero_default x) {rep_ *= x.rep_; return *this;}
+ zero_default& operator/=(zero_default x) {rep_ /= x.rep_; return *this;}
+
+ zero_default operator+ () const {return *this;}
+ zero_default operator- () const {return zero_default(-rep_);}
+ zero_default& operator++() {++rep_; return *this;}
+ zero_default operator++(int) {return zero_default(rep_++);}
+ zero_default& operator--() {--rep_; return *this;}
+ zero_default operator--(int) {return zero_default(rep_--);}
+
+ friend zero_default operator+(zero_default x, zero_default y) {return x += y;}
+ friend zero_default operator-(zero_default x, zero_default y) {return x -= y;}
+ friend zero_default operator*(zero_default x, zero_default y) {return x *= y;}
+ friend zero_default operator/(zero_default x, zero_default y) {return x /= y;}
+
+ friend bool operator==(zero_default x, zero_default y) {return x.rep_ == y.rep_;}
+ friend bool operator!=(zero_default x, zero_default y) {return !(x == y);}
+ friend bool operator< (zero_default x, zero_default y) {return x.rep_ < y.rep_;}
+ friend bool operator<=(zero_default x, zero_default y) {return !(y < x);}
+ friend bool operator> (zero_default x, zero_default y) {return y < x;}
+ friend bool operator>=(zero_default x, zero_default y) {return !(x < y);}
+};
+
+typedef boost::chrono::duration<zero_default<long long>, boost::nano > nanoseconds;
+typedef boost::chrono::duration<zero_default<long long>, boost::micro > microseconds;
+typedef boost::chrono::duration<zero_default<long long>, boost::milli > milliseconds;
+typedef boost::chrono::duration<zero_default<long long> > seconds;
+typedef boost::chrono::duration<zero_default<long long>, boost::ratio<60> > minutes;
+typedef boost::chrono::duration<zero_default<long long>, boost::ratio<3600> > hours;
+
+void test()
+{
+ milliseconds ms;
+ std::cout << ms.count() << '\n';
+}
+
+} // I_dont_like_the_default_duration_behavior
+
+
+int main()
+{
+ I_dont_like_the_default_duration_behavior::test();
+ return 0;
+}
+

Added: sandbox/chrono/libs/chrono/example/min_time_point.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/example/min_time_point.cpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,75 @@
+// min_time_point.cpp ----------------------------------------------------------//
+
+// Copyright 2008 Howard Hinnant
+// Copyright 2008 Beman Dawes
+// Copyright 2009 Vicente J. Botet Escriba
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+/*
+This code was extracted by Vicente J. Botet Escriba from Beman Dawes time2_demo.cpp which
+was derived by Beman Dawes from Howard Hinnant's time2_demo prototype.
+Many thanks to Howard for making his code available under the Boost license.
+The original code was modified to conform to Boost conventions and to section
+20.9 Time utilities [time] of the C++ committee's working paper N2798.
+See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf.
+
+time2_demo contained this comment:
+
+ Much thanks to Andrei Alexandrescu,
+ Walter Brown,
+ Peter Dimov,
+ Jeff Garland,
+ Terry Golubiewski,
+ Daniel Krügler,
+ Anthony Williams.
+*/
+
+#include <boost/chrono/chrono.hpp>
+#include <boost/type_traits.hpp>
+
+#include <iostream>
+
+#undef min
+#undef max
+
+using namespace boost::chrono;
+
+template <class Rep, class Period>
+void print_duration(std::ostream& os, duration<Rep, Period> d)
+{
+ os << d.count() << " * " << Period::num << '/' << Period::den << " seconds\n";
+}
+
+// Example min utility: returns the earliest time_point
+// Being able to *easily* write this function is a major feature!
+template <class Clock, class Duration1, class Duration2>
+inline
+typename boost::common_type<time_point<Clock, Duration1>,
+ time_point<Clock, Duration2> >::type
+min(time_point<Clock, Duration1> t1, time_point<Clock, Duration2> t2)
+{
+ return t2 < t1 ? t2 : t1;
+}
+
+void test_min()
+{
+ typedef time_point<system_clock,
+ boost::common_type<system_clock::duration, seconds>::type> T1;
+ typedef time_point<system_clock,
+ boost::common_type<system_clock::duration, nanoseconds>::type> T2;
+ typedef boost::common_type<T1, T2>::type T3;
+ /*auto*/ T1 t1 = system_clock::now() + seconds(3);
+ /*auto*/ T2 t2 = system_clock::now() + nanoseconds(3);
+ /*auto*/ T3 t3 = min(t1, t2);
+ print_duration(std::cout, t1 - t3);
+ print_duration(std::cout, t2 - t3);
+}
+
+int main()
+{
+ test_min();
+ return 0;
+}
+

Added: sandbox/chrono/libs/chrono/example/runtime_resolution.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/example/runtime_resolution.cpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,228 @@
+// runtime_resolution.cpp ----------------------------------------------------------//
+
+// Copyright 2008 Howard Hinnant
+// Copyright 2008 Beman Dawes
+// Copyright 2009 Vicente J. Botet Escriba
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+/*
+This code was extracted by Vicente J. Botet Escriba from Beman Dawes time2_demo.cpp which
+was derived by Beman Dawes from Howard Hinnant's time2_demo prototype.
+Many thanks to Howard for making his code available under the Boost license.
+The original code was modified to conform to Boost conventions and to section
+20.9 Time utilities [time] of the C++ committee's working paper N2798.
+See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf.
+
+time2_demo contained this comment:
+
+ Much thanks to Andrei Alexandrescu,
+ Walter Brown,
+ Peter Dimov,
+ Jeff Garland,
+ Terry Golubiewski,
+ Daniel Krügler,
+ Anthony Williams.
+*/
+
+#include <boost/chrono/chrono.hpp>
+#include <boost/type_traits.hpp>
+
+#include <iostream>
+
+#if defined(BOOST_CHRONO_WINDOWS_API)
+
+namespace
+{
+ //struct timeval {
+ // long tv_sec; /* seconds */
+ // long tv_usec; /* and microseconds */
+ //};
+
+ int gettimeofday(struct timeval * tp, void *)
+ {
+ FILETIME ft;
+ ::GetSystemTimeAsFileTime( &ft ); // never fails
+ long long t = (static_cast<long long>(ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
+ # if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300 // > VC++ 7.0
+ t -= 116444736000000000LL;
+ # else
+ t -= 116444736000000000;
+ # endif
+ t /= 10; // microseconds
+ tp->tv_sec = static_cast<long>( t / 1000000UL);
+ tp->tv_usec = static_cast<long>( t % 1000000UL);
+ return 0;
+ }
+} // unnamed namespace
+
+#endif
+
+
+//#undef min
+//#undef max
+
+// Handle duration with resolution not known until run time
+using namespace boost::chrono;
+
+namespace runtime_resolution
+{
+
+class duration
+{
+public:
+ typedef long long rep;
+private:
+ rep rep_;
+
+ static const double ticks_per_nanosecond;
+
+public:
+ typedef boost::chrono::duration<double, boost::nano> tonanosec;
+
+ duration() {} // = default;
+ explicit duration(const rep& r) : rep_(r) {}
+
+ // conversions
+ explicit duration(const tonanosec& d)
+ : rep_(static_cast<rep>(d.count() * ticks_per_nanosecond)) {}
+
+ // explicit
+ operator tonanosec() const {return tonanosec(rep_/ticks_per_nanosecond);}
+
+ // observer
+
+ rep count() const {return rep_;}
+
+ // arithmetic
+
+ duration& operator+=(const duration& d) {rep_ += d.rep_; return *this;}
+ duration& operator-=(const duration& d) {rep_ += d.rep_; return *this;}
+ duration& operator*=(rep rhs) {rep_ *= rhs; return *this;}
+ duration& operator/=(rep rhs) {rep_ /= rhs; return *this;}
+
+ duration operator+() const {return *this;}
+ duration operator-() const {return duration(-rep_);}
+ duration& operator++() {++rep_; return *this;}
+ duration operator++(int) {return duration(rep_++);}
+ duration& operator--() {--rep_; return *this;}
+ duration operator--(int) {return duration(rep_--);}
+
+ friend duration operator+(duration x, duration y) {return x += y;}
+ friend duration operator-(duration x, duration y) {return x -= y;}
+ friend duration operator*(duration x, rep y) {return x *= y;}
+ friend duration operator*(rep x, duration y) {return y *= x;}
+ friend duration operator/(duration x, rep y) {return x /= y;}
+
+ friend bool operator==(duration x, duration y) {return x.rep_ == y.rep_;}
+ friend bool operator!=(duration x, duration y) {return !(x == y);}
+ friend bool operator< (duration x, duration y) {return x.rep_ < y.rep_;}
+ friend bool operator<=(duration x, duration y) {return !(y < x);}
+ friend bool operator> (duration x, duration y) {return y < x;}
+ friend bool operator>=(duration x, duration y) {return !(x < y);}
+};
+
+static
+double
+init_duration()
+{
+#if defined(BOOST_CHRONO_WINDOWS_API)
+ return static_cast<double>(1) / 1000; // Windows FILETIME is 1 per microsec
+#elif defined(BOOST_CHRONO_MAC_API)
+ mach_timebase_info_data_t MachInfo;
+ mach_timebase_info(&MachInfo);
+ return static_cast<double>(MachInfo.denom) / MachInfo.numer;
+#elif defined(BOOST_CHRONO_POSIX_API)
+ return static_cast<double>(1) / 1000;
+#endif
+
+}
+
+const double duration::ticks_per_nanosecond = init_duration();
+
+class clock;
+
+class time_point
+{
+public:
+ typedef runtime_resolution::clock clock;
+ typedef long long rep;
+private:
+ rep rep_;
+
+
+ rep count() const {return rep_;}
+public:
+
+ time_point() : rep_(0) {}
+ explicit time_point(const duration& d)
+ : rep_(d.count()) {}
+
+ // arithmetic
+
+ time_point& operator+=(const duration& d) {rep_ += d.count(); return *this;}
+ time_point& operator-=(const duration& d) {rep_ -= d.count(); return *this;}
+
+ friend time_point operator+(time_point x, duration y) {return x += y;}
+ friend time_point operator+(duration x, time_point y) {return y += x;}
+ friend time_point operator-(time_point x, duration y) {return x -= y;}
+ friend duration operator-(time_point x, time_point y) {return duration(x.rep_ - y.rep_);}
+};
+
+class clock
+{
+public:
+ typedef duration::rep rep;
+ typedef runtime_resolution::duration duration;
+ typedef runtime_resolution::time_point time_point;
+
+ static time_point now()
+ {
+
+#if defined(BOOST_CHRONO_WINDOWS_API)
+ timeval tv;
+ gettimeofday( &tv, 0 );
+ return time_point(duration((static_cast<rep>(tv.tv_sec)<<32) | tv.tv_usec));
+
+#elif defined(BOOST_CHRONO_MAC_API)
+
+ timeval tv;
+ gettimeofday( &tv, 0 );
+ return time_point(duration((static_cast<rep>(tv.tv_sec)<<32) | tv.tv_usec));
+
+#elif defined(BOOST_CHRONO_POSIX_API)
+ timespec ts;
+ ::clock_gettime( CLOCK_REALTIME, &ts );
+
+ return time_point(duration((static_cast<rep>(ts.tv_sec)<<32) | ts.tv_nsec/1000));
+
+
+#endif // POSIX
+
+ }
+};
+
+void test()
+{
+ using namespace boost::chrono;
+ std::cout << "runtime_resolution test\n";
+ clock::duration delay(boost::chrono::milliseconds(5));
+ clock::time_point start = clock::now();
+ while (clock::now() - start <= delay)
+ ;
+ clock::time_point stop = clock::now();
+ clock::duration elapsed = stop - start;
+ std::cout << "paused " << nanoseconds(duration_cast<nanoseconds>(duration::tonanosec(elapsed))).count()
+ << " nanoseconds\n";
+}
+
+} // runtime_resolution
+
+
+int main()
+{
+ runtime_resolution::test();
+ return 0;
+}
+

Added: sandbox/chrono/libs/chrono/example/saturating.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/example/saturating.cpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,508 @@
+// saturating.cpp ----------------------------------------------------------//
+
+// Copyright 2008 Howard Hinnant
+// Copyright 2008 Beman Dawes
+// Copyright 2009 Vicente J. Botet Escriba
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+/*
+This code was extracted by Vicente J. Botet Escriba from Beman Dawes time2_demo.cpp which
+was derived by Beman Dawes from Howard Hinnant's time2_demo prototype.
+Many thanks to Howard for making his code available under the Boost license.
+The original code was modified to conform to Boost conventions and to section
+20.9 Time utilities [time] of the C++ committee's working paper N2798.
+See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf.
+
+time2_demo contained this comment:
+
+ Much thanks to Andrei Alexandrescu,
+ Walter Brown,
+ Peter Dimov,
+ Jeff Garland,
+ Terry Golubiewski,
+ Daniel Krügler,
+ Anthony Williams.
+*/
+
+#define _CRT_SECURE_NO_WARNINGS // disable VC++ foolishness
+
+#include <boost/chrono/chrono.hpp>
+#include <boost/type_traits.hpp>
+
+#include <iostream>
+
+#undef min
+#undef max
+
+//////////////////////////////////////////////////////////
+//////////////////// User2 Example ///////////////////////
+//////////////////////////////////////////////////////////
+
+// Demonstrate User2:
+// A "saturating" signed integral type is developed. This type has +/- infinity and a nan
+// (like IEEE floating point) but otherwise obeys signed integral arithmetic.
+// This class is subsequently used as the rep in boost::chrono::duration to demonstrate a
+// duration class that does not silently ignore overflow.
+#include <ostream>
+#include <stdexcept>
+#include <climits>
+
+namespace User2
+{
+
+template <class I>
+class saturate
+{
+public:
+ typedef I int_type;
+
+ static const int_type nan = int_type(int_type(1) << (sizeof(int_type) * CHAR_BIT - 1));
+ static const int_type neg_inf = nan + 1;
+ static const int_type pos_inf = -neg_inf;
+private:
+ int_type i_;
+
+// static_assert(std::is_integral<int_type>::value && std::is_signed<int_type>::value,
+// "saturate only accepts signed integral types");
+// static_assert(nan == -nan && neg_inf < pos_inf,
+// "saturate assumes two's complement hardware for signed integrals");
+
+public:
+ saturate() : i_(nan) {}
+ explicit saturate(int_type i) : i_(i) {}
+ // explicit
+ operator int_type() const;
+
+ saturate& operator+=(saturate x);
+ saturate& operator-=(saturate x) {return *this += -x;}
+ saturate& operator*=(saturate x);
+ saturate& operator/=(saturate x);
+ saturate& operator%=(saturate x);
+
+ saturate operator- () const {return saturate(-i_);}
+ saturate& operator++() {*this += saturate(int_type(1)); return *this;}
+ saturate operator++(int) {saturate tmp(*this); ++(*this); return tmp;}
+ saturate& operator--() {*this -= saturate(int_type(1)); return *this;}
+ saturate operator--(int) {saturate tmp(*this); --(*this); return tmp;}
+
+ friend saturate operator+(saturate x, saturate y) {return x += y;}
+ friend saturate operator-(saturate x, saturate y) {return x -= y;}
+ friend saturate operator*(saturate x, saturate y) {return x *= y;}
+ friend saturate operator/(saturate x, saturate y) {return x /= y;}
+ friend saturate operator%(saturate x, saturate y) {return x %= y;}
+
+ friend bool operator==(saturate x, saturate y)
+ {
+ if (x.i_ == nan || y.i_ == nan)
+ return false;
+ return x.i_ == y.i_;
+ }
+
+ friend bool operator!=(saturate x, saturate y) {return !(x == y);}
+
+ friend bool operator<(saturate x, saturate y)
+ {
+ if (x.i_ == nan || y.i_ == nan)
+ return false;
+ return x.i_ < y.i_;
+ }
+
+ friend bool operator<=(saturate x, saturate y)
+ {
+ if (x.i_ == nan || y.i_ == nan)
+ return false;
+ return x.i_ <= y.i_;
+ }
+
+ friend bool operator>(saturate x, saturate y)
+ {
+ if (x.i_ == nan || y.i_ == nan)
+ return false;
+ return x.i_ > y.i_;
+ }
+
+ friend bool operator>=(saturate x, saturate y)
+ {
+ if (x.i_ == nan || y.i_ == nan)
+ return false;
+ return x.i_ >= y.i_;
+ }
+
+ friend std::ostream& operator<<(std::ostream& os, saturate s)
+ {
+ switch (s.i_)
+ {
+ case pos_inf:
+ return os << "inf";
+ case nan:
+ return os << "nan";
+ case neg_inf:
+ return os << "-inf";
+ };
+ return os << s.i_;
+ }
+};
+
+template <class I>
+saturate<I>::operator int_type() const
+{
+ switch (i_)
+ {
+ case nan:
+ case neg_inf:
+ case pos_inf:
+ throw std::out_of_range("saturate special value can not convert to int_type");
+ }
+ return i_;
+}
+
+template <class I>
+saturate<I>&
+saturate<I>::operator+=(saturate x)
+{
+ switch (i_)
+ {
+ case pos_inf:
+ switch (x.i_)
+ {
+ case neg_inf:
+ case nan:
+ i_ = nan;
+ }
+ return *this;
+ case nan:
+ return *this;
+ case neg_inf:
+ switch (x.i_)
+ {
+ case pos_inf:
+ case nan:
+ i_ = nan;
+ }
+ return *this;
+ }
+ switch (x.i_)
+ {
+ case pos_inf:
+ case neg_inf:
+ case nan:
+ i_ = x.i_;
+ return *this;
+ }
+ if (x.i_ >= 0)
+ {
+ if (i_ < pos_inf - x.i_)
+ i_ += x.i_;
+ else
+ i_ = pos_inf;
+ return *this;
+ }
+ if (i_ > neg_inf - x.i_)
+ i_ += x.i_;
+ else
+ i_ = neg_inf;
+ return *this;
+}
+
+template <class I>
+saturate<I>&
+saturate<I>::operator*=(saturate x)
+{
+ switch (i_)
+ {
+ case 0:
+ switch (x.i_)
+ {
+ case pos_inf:
+ case neg_inf:
+ case nan:
+ i_ = nan;
+ }
+ return *this;
+ case pos_inf:
+ switch (x.i_)
+ {
+ case nan:
+ case 0:
+ i_ = nan;
+ return *this;
+ }
+ if (x.i_ < 0)
+ i_ = neg_inf;
+ return *this;
+ case nan:
+ return *this;
+ case neg_inf:
+ switch (x.i_)
+ {
+ case nan:
+ case 0:
+ i_ = nan;
+ return *this;
+ }
+ if (x.i_ < 0)
+ i_ = pos_inf;
+ return *this;
+ }
+ switch (x.i_)
+ {
+ case 0:
+ i_ = 0;
+ return *this;
+ case nan:
+ i_ = nan;
+ return *this;
+ case pos_inf:
+ if (i_ < 0)
+ i_ = neg_inf;
+ else
+ i_ = pos_inf;
+ return *this;
+ case neg_inf:
+ if (i_ < 0)
+ i_ = pos_inf;
+ else
+ i_ = neg_inf;
+ return *this;
+ }
+ int s = (i_ < 0 ? -1 : 1) * (x.i_ < 0 ? -1 : 1);
+ i_ = i_ < 0 ? -i_ : i_;
+ int_type x_i_ = x.i_ < 0 ? -x.i_ : x.i_;
+ if (i_ <= pos_inf / x_i_)
+ i_ *= x_i_;
+ else
+ i_ = pos_inf;
+ i_ *= s;
+ return *this;
+}
+
+template <class I>
+saturate<I>&
+saturate<I>::operator/=(saturate x)
+{
+ switch (x.i_)
+ {
+ case pos_inf:
+ case neg_inf:
+ switch (i_)
+ {
+ case pos_inf:
+ case neg_inf:
+ case nan:
+ i_ = nan;
+ break;
+ default:
+ i_ = 0;
+ break;
+ }
+ return *this;
+ case nan:
+ i_ = nan;
+ return *this;
+ case 0:
+ switch (i_)
+ {
+ case pos_inf:
+ case neg_inf:
+ case nan:
+ return *this;
+ case 0:
+ i_ = nan;
+ return *this;
+ }
+ if (i_ > 0)
+ i_ = pos_inf;
+ else
+ i_ = neg_inf;
+ return *this;
+ }
+ switch (i_)
+ {
+ case 0:
+ case nan:
+ return *this;
+ case pos_inf:
+ case neg_inf:
+ if (x.i_ < 0)
+ i_ = -i_;
+ return *this;
+ }
+ i_ /= x.i_;
+ return *this;
+}
+
+template <class I>
+saturate<I>&
+saturate<I>::operator%=(saturate x)
+{
+// *this -= *this / x * x; // definition
+ switch (x.i_)
+ {
+ case nan:
+ case neg_inf:
+ case 0:
+ case pos_inf:
+ i_ = nan;
+ return *this;
+ }
+ switch (i_)
+ {
+ case neg_inf:
+ case pos_inf:
+ i_ = nan;
+ case nan:
+ return *this;
+ }
+ i_ %= x.i_;
+ return *this;
+}
+
+// Demo overflow-safe integral durations ranging from picoseconds resolution to millennium resolution
+typedef boost::chrono::duration<saturate<long long>, boost::pico > picoseconds;
+typedef boost::chrono::duration<saturate<long long>, boost::nano > nanoseconds;
+typedef boost::chrono::duration<saturate<long long>, boost::micro > microseconds;
+typedef boost::chrono::duration<saturate<long long>, boost::milli > milliseconds;
+typedef boost::chrono::duration<saturate<long long> > seconds;
+typedef boost::chrono::duration<saturate<long long>, boost::ratio< 60LL> > minutes;
+typedef boost::chrono::duration<saturate<long long>, boost::ratio< 3600LL> > hours;
+typedef boost::chrono::duration<saturate<long long>, boost::ratio< 86400LL> > days;
+typedef boost::chrono::duration<saturate<long long>, boost::ratio< 31556952LL> > years;
+typedef boost::chrono::duration<saturate<long long>, boost::ratio<31556952000LL> > millennium;
+
+} // User2
+
+// Demonstrate custom promotion rules (needed only if there are no implicit conversions)
+namespace User2 { namespace detail {
+
+template <class T1, class T2, bool = boost::is_integral<T1>::value>
+struct promote_helper;
+
+template <class T1, class T2>
+struct promote_helper<T1, saturate<T2>, true> // integral
+{
+ typedef typename boost::common_type<T1, T2>::type rep;
+ typedef User2::saturate<rep> type;
+};
+
+template <class T1, class T2>
+struct promote_helper<T1, saturate<T2>, false> // floating
+{
+ typedef T1 type;
+};
+
+} }
+
+namespace boost
+{
+
+template <class T1, class T2>
+struct common_type<User2::saturate<T1>, User2::saturate<T2> >
+{
+ typedef typename common_type<T1, T2>::type rep;
+ typedef User2::saturate<rep> type;
+};
+
+template <class T1, class T2>
+struct common_type<T1, User2::saturate<T2> >
+ : User2::detail::promote_helper<T1, User2::saturate<T2> > {};
+
+template <class T1, class T2>
+struct common_type<User2::saturate<T1>, T2>
+ : User2::detail::promote_helper<T2, User2::saturate<T1> > {};
+
+
+// Demonstrate specialization of duration_values:
+
+namespace chrono {
+
+template <class I>
+struct duration_values<User2::saturate<I> >
+{
+ typedef User2::saturate<I> Rep;
+public:
+ static Rep zero() {return Rep(0);}
+ static Rep max() {return Rep(Rep::pos_inf-1);}
+ static Rep min() {return -max();}
+};
+
+} // namespace chrono
+
+} // namespace boost
+
+#include <iostream>
+
+void testUser2()
+{
+ std::cout << "*************\n";
+ std::cout << "* testUser2 *\n";
+ std::cout << "*************\n";
+ using namespace User2;
+ typedef seconds::rep sat;
+ years yr(sat(100));
+ std::cout << "100 years expressed as years = " << yr.count() << '\n';
+ nanoseconds ns = yr;
+ std::cout << "100 years expressed as nanoseconds = " << ns.count() << '\n';
+ ns += yr;
+ std::cout << "200 years expressed as nanoseconds = " << ns.count() << '\n';
+ ns += yr;
+ std::cout << "300 years expressed as nanoseconds = " << ns.count() << '\n';
+// yr = ns; // does not compile
+ std::cout << "yr = ns; // does not compile\n";
+// picoseconds ps1 = yr; // does not compile, compile-time overflow in ratio arithmetic
+ std::cout << "ps = yr; // does not compile\n";
+ ns = yr;
+ picoseconds ps = ns;
+ std::cout << "100 years expressed as picoseconds = " << ps.count() << '\n';
+ ps = ns / sat(1000);
+ std::cout << "0.1 years expressed as picoseconds = " << ps.count() << '\n';
+ yr = years(sat(-200000000));
+ std::cout << "200 million years ago encoded in years: " << yr.count() << '\n';
+ days d = boost::chrono::duration_cast<days>(yr);
+ std::cout << "200 million years ago encoded in days: " << d.count() << '\n';
+ millennium c = boost::chrono::duration_cast<millennium>(yr);
+ std::cout << "200 million years ago encoded in millennium: " << c.count() << '\n';
+ std::cout << "Demonstrate \"uninitialized protection\" behavior:\n";
+ seconds sec;
+ for (++sec; sec < seconds(sat(10)); ++sec)
+ ;
+ std::cout << sec.count() << '\n';
+ std::cout << "\n";
+}
+
+void testStdUser()
+{
+ std::cout << "***************\n";
+ std::cout << "* testStdUser *\n";
+ std::cout << "***************\n";
+ using namespace boost::chrono;
+ hours hr = hours(100);
+ std::cout << "100 hours expressed as hours = " << hr.count() << '\n';
+ nanoseconds ns = hr;
+ std::cout << "100 hours expressed as nanoseconds = " << ns.count() << '\n';
+ ns += hr;
+ std::cout << "200 hours expressed as nanoseconds = " << ns.count() << '\n';
+ ns += hr;
+ std::cout << "300 hours expressed as nanoseconds = " << ns.count() << '\n';
+// hr = ns; // does not compile
+ std::cout << "hr = ns; // does not compile\n";
+// hr * ns; // does not compile
+ std::cout << "hr * ns; // does not compile\n";
+ duration<double> fs(2.5);
+ std::cout << "duration<double> has count() = " << fs.count() << '\n';
+// seconds sec = fs; // does not compile
+ std::cout << "seconds sec = duration<double> won't compile\n";
+ seconds sec = duration_cast<seconds>(fs);
+ std::cout << "seconds has count() = " << sec.count() << '\n';
+ std::cout << "\n";
+}
+
+
+int main()
+{
+ testStdUser();
+ testUser2();
+ return 0;
+}
+

Added: sandbox/chrono/libs/chrono/example/simulated_thread_interface_demo.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/example/simulated_thread_interface_demo.cpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,982 @@
+// simulated_thread_interface_demo.cpp ----------------------------------------------------------//
+
+// Copyright 2008 Howard Hinnant
+// Copyright 2008 Beman Dawes
+// Copyright 2009 Vicente J. Botet Escriba
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+/*
+This code was extracted by Vicente J. Botet Escriba from Beman Dawes time2_demo.cpp which
+was derived by Beman Dawes from Howard Hinnant's time2_demo prototype.
+Many thanks to Howard for making his code available under the Boost license.
+The original code was modified to conform to Boost conventions and to section
+20.9 Time utilities [time] of the C++ committee's working paper N2798.
+See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf.
+
+time2_demo contained this comment:
+
+ Much thanks to Andrei Alexandrescu,
+ Walter Brown,
+ Peter Dimov,
+ Jeff Garland,
+ Terry Golubiewski,
+ Daniel Krügler,
+ Anthony Williams.
+*/
+
+#define _CRT_SECURE_NO_WARNINGS // disable VC++ foolishness
+
+#include <boost/chrono/chrono.hpp>
+#include <boost/type_traits.hpp>
+
+#include <iostream>
+
+#include <windows.h>
+#undef min
+#undef max
+
+#if defined(BOOST_CHRONO_WINDOWS_API)
+
+namespace
+{
+ //struct timeval {
+ // long tv_sec; /* seconds */
+ // long tv_usec; /* and microseconds */
+ //};
+
+ int gettimeofday(struct timeval * tp, void *)
+ {
+ FILETIME ft;
+ ::GetSystemTimeAsFileTime( &ft ); // never fails
+ long long t = (static_cast<long long>(ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
+ # if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300 // > VC++ 7.0
+ t -= 116444736000000000LL;
+ # else
+ t -= 116444736000000000;
+ # endif
+ t /= 10; // microseconds
+ tp->tv_sec = static_cast<long>( t / 1000000UL);
+ tp->tv_usec = static_cast<long>( t % 1000000UL);
+ return 0;
+ }
+} // unnamed namespace
+
+#endif
+
+//////////////////////////////////////////////////////////
+///////////// simulated thread interface /////////////////
+//////////////////////////////////////////////////////////
+
+#include <iostream>
+
+namespace std {
+
+void __print_time(boost::chrono::system_clock::time_point t)
+{
+ using namespace boost::chrono;
+ time_t c_time = system_clock::to_time_t(t);
+ std::tm* tmptr = std::localtime(&c_time);
+ system_clock::duration d = t.time_since_epoch();
+ std::cout << tmptr->tm_hour << ':' << tmptr->tm_min << ':' << tmptr->tm_sec
+ << '.' << (d - duration_cast<seconds>(d)).count();
+}
+
+namespace this_thread {
+
+template <class Rep, class Period>
+void sleep_for(const boost::chrono::duration<Rep, Period>& d)
+{
+ boost::chrono::microseconds t = boost::chrono::duration_cast<boost::chrono::microseconds>(d);
+ if (t < d)
+ ++t;
+ if (t > boost::chrono::microseconds(0))
+ std::cout << "sleep_for " << t.count() << " microseconds\n";
+}
+
+template <class Clock, class Duration>
+void sleep_until(const boost::chrono::time_point<Clock, Duration>& t)
+{
+ using namespace boost::chrono;
+ typedef time_point<Clock, Duration> Time;
+ typedef system_clock::time_point SysTime;
+ if (t > Clock::now())
+ {
+ typedef typename boost::common_type<typename Time::duration,
+ typename SysTime::duration>::type D;
+ /* auto */ D d = t - Clock::now();
+ microseconds us = duration_cast<microseconds>(d);
+ if (us < d)
+ ++us;
+ SysTime st = system_clock::now() + us;
+ std::cout << "sleep_until ";
+ __print_time(st);
+ std::cout << " which is " << (st - system_clock::now()).count() << " microseconds away\n";
+ }
+}
+
+} // this_thread
+
+struct mutex {};
+
+struct timed_mutex
+{
+ bool try_lock() {std::cout << "timed_mutex::try_lock()\n"; return true;}
+
+ template <class Rep, class Period>
+ bool try_lock_for(const boost::chrono::duration<Rep, Period>& d)
+ {
+ boost::chrono::microseconds t = boost::chrono::duration_cast<boost::chrono::microseconds>(d);
+ if (t <= boost::chrono::microseconds(0))
+ return try_lock();
+ std::cout << "try_lock_for " << t.count() << " microseconds\n";
+ return true;
+ }
+
+ template <class Clock, class Duration>
+ bool try_lock_until(const boost::chrono::time_point<Clock, Duration>& t)
+ {
+ using namespace boost::chrono;
+ typedef time_point<Clock, Duration> Time;
+ typedef system_clock::time_point SysTime;
+ if (t <= Clock::now())
+ return try_lock();
+ typedef typename boost::common_type<typename Time::duration,
+ typename Clock::duration>::type D;
+ /* auto */ D d = t - Clock::now();
+ microseconds us = duration_cast<microseconds>(d);
+ SysTime st = system_clock::now() + us;
+ std::cout << "try_lock_until ";
+ __print_time(st);
+ std::cout << " which is " << (st - system_clock::now()).count()
+ << " microseconds away\n";
+ return true;
+ }
+};
+
+struct condition_variable
+{
+ template <class Rep, class Period>
+ bool wait_for(mutex&, const boost::chrono::duration<Rep, Period>& d)
+ {
+ boost::chrono::microseconds t = boost::chrono::duration_cast<boost::chrono::microseconds>(d);
+ std::cout << "wait_for " << t.count() << " microseconds\n";
+ return true;
+ }
+
+ template <class Clock, class Duration>
+ bool wait_until(mutex&, const boost::chrono::time_point<Clock, Duration>& t)
+ {
+ using namespace boost::chrono;
+ typedef time_point<Clock, Duration> Time;
+ typedef system_clock::time_point SysTime;
+ if (t <= Clock::now())
+ return false;
+ typedef typename boost::common_type<typename Time::duration,
+ typename Clock::duration>::type D;
+ /* auto */ D d = t - Clock::now();
+ microseconds us = duration_cast<microseconds>(d);
+ SysTime st = system_clock::now() + us;
+ std::cout << "wait_until ";
+ __print_time(st);
+ std::cout << " which is " << (st - system_clock::now()).count()
+ << " microseconds away\n";
+ return true;
+ }
+};
+
+} // namespace std
+
+//////////////////////////////////////////////////////////
+//////////// Simple sleep and wait examples //////////////
+//////////////////////////////////////////////////////////
+
+std::mutex m;
+std::timed_mutex mut;
+std::condition_variable cv;
+
+void basic_examples()
+{
+ std::cout << "Running basic examples\n";
+ using namespace std;
+ using namespace boost::chrono;
+ system_clock::time_point time_limit = system_clock::now() + seconds(4) + milliseconds(500);
+ this_thread::sleep_for(seconds(3));
+ this_thread::sleep_for(nanoseconds(300));
+ this_thread::sleep_until(time_limit);
+// this_thread::sleep_for(time_limit); // desired compile-time error
+// this_thread::sleep_until(seconds(3)); // desired compile-time error
+ mut.try_lock_for(milliseconds(30));
+ mut.try_lock_until(time_limit);
+// mut.try_lock_for(time_limit); // desired compile-time error
+// mut.try_lock_until(milliseconds(30)); // desired compile-time error
+ cv.wait_for(m, minutes(1)); // real code would put this in a loop
+ cv.wait_until(m, time_limit); // real code would put this in a loop
+ // For those who prefer floating point
+ this_thread::sleep_for(duration<double>(0.25));
+ this_thread::sleep_until(system_clock::now() + duration<double>(1.5));
+}
+
+
+
+//////////////////////////////////////////////////////////
+//////////////////// User2 Example ///////////////////////
+//////////////////////////////////////////////////////////
+
+// Demonstrate User2:
+// A "saturating" signed integral type is developed. This type has +/- infinity and a nan
+// (like IEEE floating point) but otherwise obeys signed integral arithmetic.
+// This class is subsequently used as the rep in boost::chrono::duration to demonstrate a
+// duration class that does not silently ignore overflow.
+#include <ostream>
+#include <stdexcept>
+#include <climits>
+
+namespace User2
+{
+
+template <class I>
+class saturate
+{
+public:
+ typedef I int_type;
+
+ static const int_type nan = int_type(int_type(1) << (sizeof(int_type) * CHAR_BIT - 1));
+ static const int_type neg_inf = nan + 1;
+ static const int_type pos_inf = -neg_inf;
+private:
+ int_type i_;
+
+// static_assert(std::is_integral<int_type>::value && std::is_signed<int_type>::value,
+// "saturate only accepts signed integral types");
+// static_assert(nan == -nan && neg_inf < pos_inf,
+// "saturate assumes two's complement hardware for signed integrals");
+
+public:
+ saturate() : i_(nan) {}
+ explicit saturate(int_type i) : i_(i) {}
+ // explicit
+ operator int_type() const;
+
+ saturate& operator+=(saturate x);
+ saturate& operator-=(saturate x) {return *this += -x;}
+ saturate& operator*=(saturate x);
+ saturate& operator/=(saturate x);
+ saturate& operator%=(saturate x);
+
+ saturate operator- () const {return saturate(-i_);}
+ saturate& operator++() {*this += saturate(int_type(1)); return *this;}
+ saturate operator++(int) {saturate tmp(*this); ++(*this); return tmp;}
+ saturate& operator--() {*this -= saturate(int_type(1)); return *this;}
+ saturate operator--(int) {saturate tmp(*this); --(*this); return tmp;}
+
+ friend saturate operator+(saturate x, saturate y) {return x += y;}
+ friend saturate operator-(saturate x, saturate y) {return x -= y;}
+ friend saturate operator*(saturate x, saturate y) {return x *= y;}
+ friend saturate operator/(saturate x, saturate y) {return x /= y;}
+ friend saturate operator%(saturate x, saturate y) {return x %= y;}
+
+ friend bool operator==(saturate x, saturate y)
+ {
+ if (x.i_ == nan || y.i_ == nan)
+ return false;
+ return x.i_ == y.i_;
+ }
+
+ friend bool operator!=(saturate x, saturate y) {return !(x == y);}
+
+ friend bool operator<(saturate x, saturate y)
+ {
+ if (x.i_ == nan || y.i_ == nan)
+ return false;
+ return x.i_ < y.i_;
+ }
+
+ friend bool operator<=(saturate x, saturate y)
+ {
+ if (x.i_ == nan || y.i_ == nan)
+ return false;
+ return x.i_ <= y.i_;
+ }
+
+ friend bool operator>(saturate x, saturate y)
+ {
+ if (x.i_ == nan || y.i_ == nan)
+ return false;
+ return x.i_ > y.i_;
+ }
+
+ friend bool operator>=(saturate x, saturate y)
+ {
+ if (x.i_ == nan || y.i_ == nan)
+ return false;
+ return x.i_ >= y.i_;
+ }
+
+ friend std::ostream& operator<<(std::ostream& os, saturate s)
+ {
+ switch (s.i_)
+ {
+ case pos_inf:
+ return os << "inf";
+ case nan:
+ return os << "nan";
+ case neg_inf:
+ return os << "-inf";
+ };
+ return os << s.i_;
+ }
+};
+
+template <class I>
+saturate<I>::operator int_type() const
+{
+ switch (i_)
+ {
+ case nan:
+ case neg_inf:
+ case pos_inf:
+ throw std::out_of_range("saturate special value can not convert to int_type");
+ }
+ return i_;
+}
+
+template <class I>
+saturate<I>&
+saturate<I>::operator+=(saturate x)
+{
+ switch (i_)
+ {
+ case pos_inf:
+ switch (x.i_)
+ {
+ case neg_inf:
+ case nan:
+ i_ = nan;
+ }
+ return *this;
+ case nan:
+ return *this;
+ case neg_inf:
+ switch (x.i_)
+ {
+ case pos_inf:
+ case nan:
+ i_ = nan;
+ }
+ return *this;
+ }
+ switch (x.i_)
+ {
+ case pos_inf:
+ case neg_inf:
+ case nan:
+ i_ = x.i_;
+ return *this;
+ }
+ if (x.i_ >= 0)
+ {
+ if (i_ < pos_inf - x.i_)
+ i_ += x.i_;
+ else
+ i_ = pos_inf;
+ return *this;
+ }
+ if (i_ > neg_inf - x.i_)
+ i_ += x.i_;
+ else
+ i_ = neg_inf;
+ return *this;
+}
+
+template <class I>
+saturate<I>&
+saturate<I>::operator*=(saturate x)
+{
+ switch (i_)
+ {
+ case 0:
+ switch (x.i_)
+ {
+ case pos_inf:
+ case neg_inf:
+ case nan:
+ i_ = nan;
+ }
+ return *this;
+ case pos_inf:
+ switch (x.i_)
+ {
+ case nan:
+ case 0:
+ i_ = nan;
+ return *this;
+ }
+ if (x.i_ < 0)
+ i_ = neg_inf;
+ return *this;
+ case nan:
+ return *this;
+ case neg_inf:
+ switch (x.i_)
+ {
+ case nan:
+ case 0:
+ i_ = nan;
+ return *this;
+ }
+ if (x.i_ < 0)
+ i_ = pos_inf;
+ return *this;
+ }
+ switch (x.i_)
+ {
+ case 0:
+ i_ = 0;
+ return *this;
+ case nan:
+ i_ = nan;
+ return *this;
+ case pos_inf:
+ if (i_ < 0)
+ i_ = neg_inf;
+ else
+ i_ = pos_inf;
+ return *this;
+ case neg_inf:
+ if (i_ < 0)
+ i_ = pos_inf;
+ else
+ i_ = neg_inf;
+ return *this;
+ }
+ int s = (i_ < 0 ? -1 : 1) * (x.i_ < 0 ? -1 : 1);
+ i_ = i_ < 0 ? -i_ : i_;
+ int_type x_i_ = x.i_ < 0 ? -x.i_ : x.i_;
+ if (i_ <= pos_inf / x_i_)
+ i_ *= x_i_;
+ else
+ i_ = pos_inf;
+ i_ *= s;
+ return *this;
+}
+
+template <class I>
+saturate<I>&
+saturate<I>::operator/=(saturate x)
+{
+ switch (x.i_)
+ {
+ case pos_inf:
+ case neg_inf:
+ switch (i_)
+ {
+ case pos_inf:
+ case neg_inf:
+ case nan:
+ i_ = nan;
+ break;
+ default:
+ i_ = 0;
+ break;
+ }
+ return *this;
+ case nan:
+ i_ = nan;
+ return *this;
+ case 0:
+ switch (i_)
+ {
+ case pos_inf:
+ case neg_inf:
+ case nan:
+ return *this;
+ case 0:
+ i_ = nan;
+ return *this;
+ }
+ if (i_ > 0)
+ i_ = pos_inf;
+ else
+ i_ = neg_inf;
+ return *this;
+ }
+ switch (i_)
+ {
+ case 0:
+ case nan:
+ return *this;
+ case pos_inf:
+ case neg_inf:
+ if (x.i_ < 0)
+ i_ = -i_;
+ return *this;
+ }
+ i_ /= x.i_;
+ return *this;
+}
+
+template <class I>
+saturate<I>&
+saturate<I>::operator%=(saturate x)
+{
+// *this -= *this / x * x; // definition
+ switch (x.i_)
+ {
+ case nan:
+ case neg_inf:
+ case 0:
+ case pos_inf:
+ i_ = nan;
+ return *this;
+ }
+ switch (i_)
+ {
+ case neg_inf:
+ case pos_inf:
+ i_ = nan;
+ case nan:
+ return *this;
+ }
+ i_ %= x.i_;
+ return *this;
+}
+
+// Demo overflow-safe integral durations ranging from picoseconds resolution to millennium resolution
+typedef boost::chrono::duration<saturate<long long>, boost::pico > picoseconds;
+typedef boost::chrono::duration<saturate<long long>, boost::nano > nanoseconds;
+typedef boost::chrono::duration<saturate<long long>, boost::micro > microseconds;
+typedef boost::chrono::duration<saturate<long long>, boost::milli > milliseconds;
+typedef boost::chrono::duration<saturate<long long> > seconds;
+typedef boost::chrono::duration<saturate<long long>, boost::ratio< 60LL> > minutes;
+typedef boost::chrono::duration<saturate<long long>, boost::ratio< 3600LL> > hours;
+typedef boost::chrono::duration<saturate<long long>, boost::ratio< 86400LL> > days;
+typedef boost::chrono::duration<saturate<long long>, boost::ratio< 31556952LL> > years;
+typedef boost::chrono::duration<saturate<long long>, boost::ratio<31556952000LL> > millennium;
+
+} // User2
+
+// Demonstrate custom promotion rules (needed only if there are no implicit conversions)
+namespace User2 { namespace detail {
+
+template <class T1, class T2, bool = boost::is_integral<T1>::value>
+struct promote_helper;
+
+template <class T1, class T2>
+struct promote_helper<T1, saturate<T2>, true> // integral
+{
+ typedef typename boost::common_type<T1, T2>::type rep;
+ typedef User2::saturate<rep> type;
+};
+
+template <class T1, class T2>
+struct promote_helper<T1, saturate<T2>, false> // floating
+{
+ typedef T1 type;
+};
+
+} }
+
+namespace boost
+{
+
+template <class T1, class T2>
+struct common_type<User2::saturate<T1>, User2::saturate<T2> >
+{
+ typedef typename common_type<T1, T2>::type rep;
+ typedef User2::saturate<rep> type;
+};
+
+template <class T1, class T2>
+struct common_type<T1, User2::saturate<T2> >
+ : User2::detail::promote_helper<T1, User2::saturate<T2> > {};
+
+template <class T1, class T2>
+struct common_type<User2::saturate<T1>, T2>
+ : User2::detail::promote_helper<T2, User2::saturate<T1> > {};
+
+
+// Demonstrate specialization of duration_values:
+
+namespace chrono {
+
+template <class I>
+struct duration_values<User2::saturate<I> >
+{
+ typedef User2::saturate<I> Rep;
+public:
+ static Rep zero() {return Rep(0);}
+ static Rep max() {return Rep(Rep::pos_inf-1);}
+ static Rep min() {return -max();}
+};
+
+} // namespace chrono
+
+} // namespace boost
+
+#include <iostream>
+
+void testUser2()
+{
+ std::cout << "*************\n";
+ std::cout << "* testUser2 *\n";
+ std::cout << "*************\n";
+ using namespace User2;
+ typedef seconds::rep sat;
+ years yr(sat(100));
+ std::cout << "100 years expressed as years = " << yr.count() << '\n';
+ nanoseconds ns = yr;
+ std::cout << "100 years expressed as nanoseconds = " << ns.count() << '\n';
+ ns += yr;
+ std::cout << "200 years expressed as nanoseconds = " << ns.count() << '\n';
+ ns += yr;
+ std::cout << "300 years expressed as nanoseconds = " << ns.count() << '\n';
+// yr = ns; // does not compile
+ std::cout << "yr = ns; // does not compile\n";
+// picoseconds ps1 = yr; // does not compile, compile-time overflow in ratio arithmetic
+ std::cout << "ps = yr; // does not compile\n";
+ ns = yr;
+ picoseconds ps = ns;
+ std::cout << "100 years expressed as picoseconds = " << ps.count() << '\n';
+ ps = ns / sat(1000);
+ std::cout << "0.1 years expressed as picoseconds = " << ps.count() << '\n';
+ yr = years(sat(-200000000));
+ std::cout << "200 million years ago encoded in years: " << yr.count() << '\n';
+ days d = boost::chrono::duration_cast<days>(yr);
+ std::cout << "200 million years ago encoded in days: " << d.count() << '\n';
+ millennium c = boost::chrono::duration_cast<millennium>(yr);
+ std::cout << "200 million years ago encoded in millennium: " << c.count() << '\n';
+ std::cout << "Demonstrate \"uninitialized protection\" behavior:\n";
+ seconds sec;
+ for (++sec; sec < seconds(sat(10)); ++sec)
+ ;
+ std::cout << sec.count() << '\n';
+ std::cout << "\n";
+}
+
+void testStdUser()
+{
+ std::cout << "***************\n";
+ std::cout << "* testStdUser *\n";
+ std::cout << "***************\n";
+ using namespace boost::chrono;
+ hours hr = hours(100);
+ std::cout << "100 hours expressed as hours = " << hr.count() << '\n';
+ nanoseconds ns = hr;
+ std::cout << "100 hours expressed as nanoseconds = " << ns.count() << '\n';
+ ns += hr;
+ std::cout << "200 hours expressed as nanoseconds = " << ns.count() << '\n';
+ ns += hr;
+ std::cout << "300 hours expressed as nanoseconds = " << ns.count() << '\n';
+// hr = ns; // does not compile
+ std::cout << "hr = ns; // does not compile\n";
+// hr * ns; // does not compile
+ std::cout << "hr * ns; // does not compile\n";
+ duration<double> fs(2.5);
+ std::cout << "duration<double> has count() = " << fs.count() << '\n';
+// seconds sec = fs; // does not compile
+ std::cout << "seconds sec = duration<double> won't compile\n";
+ seconds sec = duration_cast<seconds>(fs);
+ std::cout << "seconds has count() = " << sec.count() << '\n';
+ std::cout << "\n";
+}
+
+// timeval clock demo
+// Demonstrate the use of a timeval-like struct to be used as the representation
+// type for both duraiton and time_point.
+
+namespace timeval_demo
+{
+
+class xtime {
+private:
+ long tv_sec;
+ long tv_usec;
+
+ void fixup() {
+ if (tv_usec < 0) {
+ tv_usec += 1000000;
+ --tv_sec;
+ }
+ }
+
+public:
+
+ explicit xtime(long sec, long usec) {
+ tv_sec = sec;
+ tv_usec = usec;
+ if (tv_usec < 0 || tv_usec >= 1000000) {
+ tv_sec += tv_usec / 1000000;
+ tv_usec %= 1000000;
+ fixup();
+ }
+ }
+
+ explicit xtime(long long usec)
+ {
+ tv_usec = static_cast<long>(usec % 1000000);
+ tv_sec = static_cast<long>(usec / 1000000);
+ fixup();
+ }
+
+ // explicit
+ operator long long() const {return static_cast<long long>(tv_sec) * 1000000 + tv_usec;}
+
+ xtime& operator += (xtime rhs) {
+ tv_sec += rhs.tv_sec;
+ tv_usec += rhs.tv_usec;
+ if (tv_usec >= 1000000) {
+ tv_usec -= 1000000;
+ ++tv_sec;
+ }
+ return *this;
+ }
+
+ xtime& operator -= (xtime rhs) {
+ tv_sec -= rhs.tv_sec;
+ tv_usec -= rhs.tv_usec;
+ fixup();
+ return *this;
+ }
+
+ xtime& operator %= (xtime rhs) {
+ long long t = tv_sec * 1000000 + tv_usec;
+ long long r = rhs.tv_sec * 1000000 + rhs.tv_usec;
+ t %= r;
+ tv_sec = static_cast<long>(t / 1000000);
+ tv_usec = static_cast<long>(t % 1000000);
+ fixup();
+ return *this;
+ }
+
+ friend xtime operator+(xtime x, xtime y) {return x += y;}
+ friend xtime operator-(xtime x, xtime y) {return x -= y;}
+ friend xtime operator%(xtime x, xtime y) {return x %= y;}
+
+ friend bool operator==(xtime x, xtime y)
+ { return (x.tv_sec == y.tv_sec && x.tv_usec == y.tv_usec); }
+
+ friend bool operator<(xtime x, xtime y) {
+ if (x.tv_sec == y.tv_sec)
+ return (x.tv_usec < y.tv_usec);
+ return (x.tv_sec < y.tv_sec);
+ }
+
+ friend bool operator!=(xtime x, xtime y) { return !(x == y); }
+ friend bool operator> (xtime x, xtime y) { return y < x; }
+ friend bool operator<=(xtime x, xtime y) { return !(y < x); }
+ friend bool operator>=(xtime x, xtime y) { return !(x < y); }
+
+ friend std::ostream& operator<<(std::ostream& os, xtime x)
+ {return os << '{' << x.tv_sec << ',' << x.tv_usec << '}';}
+};
+
+class xtime_clock
+{
+public:
+ typedef xtime rep;
+ typedef boost::micro period;
+ typedef boost::chrono::duration<rep, period> duration;
+ typedef boost::chrono::time_point<xtime_clock> time_point;
+
+ static time_point now();
+};
+
+xtime_clock::time_point
+xtime_clock::now()
+{
+#if defined(BOOST_CHRONO_WINDOWS_API)
+ time_point t(duration(xtime(0)));
+ gettimeofday((timeval*)&t, 0);
+ return t;
+
+#elif defined(BOOST_CHRONO_MAC_API)
+
+ time_point t(duration(xtime(0)));
+ gettimeofday((timeval*)&t, 0);
+ return t;
+
+#elif defined(BOOST_CHRONO_POSIX_API)
+ timespec ts;
+ ::clock_gettime( CLOCK_REALTIME, &ts );
+
+ xtime xt( ts.tv_sec, ts.tv_nsec/1000);
+ return time_point(duration(xt));
+
+#endif // POSIX
+}
+
+void test_xtime_clock()
+{
+ using namespace boost::chrono;
+ std::cout << "timeval_demo system clock test\n";
+ std::cout << "sizeof xtime_clock::time_point = " << sizeof(xtime_clock::time_point) << '\n';
+ std::cout << "sizeof xtime_clock::duration = " << sizeof(xtime_clock::duration) << '\n';
+ std::cout << "sizeof xtime_clock::rep = " << sizeof(xtime_clock::rep) << '\n';
+ xtime_clock::duration delay(milliseconds(5));
+ xtime_clock::time_point start = xtime_clock::now();
+ while (xtime_clock::now() - start <= delay)
+ {
+ }
+ xtime_clock::time_point stop = xtime_clock::now();
+ xtime_clock::duration elapsed = stop - start;
+ std::cout << "paused " << nanoseconds(elapsed).count() << " nanoseconds\n";
+}
+
+} // timeval_demo
+
+// Handle duration with resolution not known until run time
+
+namespace runtime_resolution
+{
+
+class duration
+{
+public:
+ typedef long long rep;
+private:
+ rep rep_;
+
+ static const double ticks_per_nanosecond;
+
+public:
+ typedef boost::chrono::duration<double, boost::nano> tonanosec;
+
+ duration() {} // = default;
+ explicit duration(const rep& r) : rep_(r) {}
+
+ // conversions
+ explicit duration(const tonanosec& d)
+ : rep_(static_cast<rep>(d.count() * ticks_per_nanosecond)) {}
+
+ // explicit
+ operator tonanosec() const {return tonanosec(rep_/ticks_per_nanosecond);}
+
+ // observer
+
+ rep count() const {return rep_;}
+
+ // arithmetic
+
+ duration& operator+=(const duration& d) {rep_ += d.rep_; return *this;}
+ duration& operator-=(const duration& d) {rep_ += d.rep_; return *this;}
+ duration& operator*=(rep rhs) {rep_ *= rhs; return *this;}
+ duration& operator/=(rep rhs) {rep_ /= rhs; return *this;}
+
+ duration operator+() const {return *this;}
+ duration operator-() const {return duration(-rep_);}
+ duration& operator++() {++rep_; return *this;}
+ duration operator++(int) {return duration(rep_++);}
+ duration& operator--() {--rep_; return *this;}
+ duration operator--(int) {return duration(rep_--);}
+
+ friend duration operator+(duration x, duration y) {return x += y;}
+ friend duration operator-(duration x, duration y) {return x -= y;}
+ friend duration operator*(duration x, rep y) {return x *= y;}
+ friend duration operator*(rep x, duration y) {return y *= x;}
+ friend duration operator/(duration x, rep y) {return x /= y;}
+
+ friend bool operator==(duration x, duration y) {return x.rep_ == y.rep_;}
+ friend bool operator!=(duration x, duration y) {return !(x == y);}
+ friend bool operator< (duration x, duration y) {return x.rep_ < y.rep_;}
+ friend bool operator<=(duration x, duration y) {return !(y < x);}
+ friend bool operator> (duration x, duration y) {return y < x;}
+ friend bool operator>=(duration x, duration y) {return !(x < y);}
+};
+
+static
+double
+init_duration()
+{
+ //mach_timebase_info_data_t MachInfo;
+ //mach_timebase_info(&MachInfo);
+ //return static_cast<double>(MachInfo.denom) / MachInfo.numer;
+ return static_cast<double>(1) / 1000; // Windows FILETIME is 1 per microsec
+}
+
+const double duration::ticks_per_nanosecond = init_duration();
+
+class clock;
+
+class time_point
+{
+public:
+ typedef runtime_resolution::clock clock;
+ typedef long long rep;
+private:
+ rep rep_;
+
+
+ rep count() const {return rep_;}
+public:
+
+ time_point() : rep_(0) {}
+ explicit time_point(const duration& d)
+ : rep_(d.count()) {}
+
+ // arithmetic
+
+ time_point& operator+=(const duration& d) {rep_ += d.count(); return *this;}
+ time_point& operator-=(const duration& d) {rep_ -= d.count(); return *this;}
+
+ friend time_point operator+(time_point x, duration y) {return x += y;}
+ friend time_point operator+(duration x, time_point y) {return y += x;}
+ friend time_point operator-(time_point x, duration y) {return x -= y;}
+ friend duration operator-(time_point x, time_point y) {return duration(x.rep_ - y.rep_);}
+};
+
+class clock
+{
+public:
+ typedef duration::rep rep;
+ typedef runtime_resolution::duration duration;
+ typedef runtime_resolution::time_point time_point;
+
+ static time_point now()
+ {
+
+#if defined(BOOST_CHRONO_WINDOWS_API)
+ timeval tv;
+ gettimeofday( &tv, 0 );
+ return time_point(duration((static_cast<rep>(tv.tv_sec)<<32) | tv.tv_usec));
+
+#elif defined(BOOST_CHRONO_MAC_API)
+
+ timeval tv;
+ gettimeofday( &tv, 0 );
+ return time_point(duration((static_cast<rep>(tv.tv_sec)<<32) | tv.tv_usec));
+
+#elif defined(BOOST_CHRONO_POSIX_API)
+ timespec ts;
+ ::clock_gettime( CLOCK_REALTIME, &ts );
+ return time_point(duration((static_cast<rep>(ts.tv_sec)<<32) | ts.tv_nsec/1000));
+
+#endif // POSIX
+
+ }
+};
+
+void test()
+{
+ using namespace boost::chrono;
+ std::cout << "runtime_resolution test\n";
+ clock::duration delay(boost::chrono::milliseconds(5));
+ clock::time_point start = clock::now();
+ while (clock::now() - start <= delay)
+ ;
+ clock::time_point stop = clock::now();
+ clock::duration elapsed = stop - start;
+ std::cout << "paused " << nanoseconds(duration_cast<nanoseconds>(duration::tonanosec(elapsed))).count()
+ << " nanoseconds\n";
+}
+
+} // runtime_resolution
+
+
+int main()
+{
+ runtime_resolution::test();
+ return 0;
+}
+

Added: sandbox/chrono/libs/chrono/example/timeval_demo.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/example/timeval_demo.cpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,218 @@
+// timeval_demo.cpp ----------------------------------------------------------//
+
+// Copyright 2008 Howard Hinnant
+// Copyright 2008 Beman Dawes
+// Copyright 2009 Vicente J. Botet Escriba
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+/*
+This code was extracted by Vicente J. Botet Escriba from Beman Dawes time2_demo.cpp which
+was derived by Beman Dawes from Howard Hinnant's time2_demo prototype.
+Many thanks to Howard for making his code available under the Boost license.
+The original code was modified to conform to Boost conventions and to section
+20.9 Time utilities [time] of the C++ committee's working paper N2798.
+See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf.
+
+time2_demo contained this comment:
+
+ Much thanks to Andrei Alexandrescu,
+ Walter Brown,
+ Peter Dimov,
+ Jeff Garland,
+ Terry Golubiewski,
+ Daniel Krügler,
+ Anthony Williams.
+*/
+
+#include <boost/chrono/chrono.hpp>
+#include <boost/type_traits.hpp>
+
+#include <iostream>
+
+#undef min
+#undef max
+
+// timeval clock demo
+// Demonstrate the use of a timeval-like struct to be used as the representation
+// type for both duraiton and time_point.
+
+namespace timeval_demo
+{
+
+class xtime {
+private:
+ long tv_sec;
+ long tv_usec;
+
+ void fixup() {
+ if (tv_usec < 0) {
+ tv_usec += 1000000;
+ --tv_sec;
+ }
+ }
+
+public:
+
+ explicit xtime(long sec, long usec) {
+ tv_sec = sec;
+ tv_usec = usec;
+ if (tv_usec < 0 || tv_usec >= 1000000) {
+ tv_sec += tv_usec / 1000000;
+ tv_usec %= 1000000;
+ fixup();
+ }
+ }
+
+ explicit xtime(long long usec)
+ {
+ tv_usec = static_cast<long>(usec % 1000000);
+ tv_sec = static_cast<long>(usec / 1000000);
+ fixup();
+ }
+
+ // explicit
+ operator long long() const {return static_cast<long long>(tv_sec) * 1000000 + tv_usec;}
+
+ xtime& operator += (xtime rhs) {
+ tv_sec += rhs.tv_sec;
+ tv_usec += rhs.tv_usec;
+ if (tv_usec >= 1000000) {
+ tv_usec -= 1000000;
+ ++tv_sec;
+ }
+ return *this;
+ }
+
+ xtime& operator -= (xtime rhs) {
+ tv_sec -= rhs.tv_sec;
+ tv_usec -= rhs.tv_usec;
+ fixup();
+ return *this;
+ }
+
+ xtime& operator %= (xtime rhs) {
+ long long t = tv_sec * 1000000 + tv_usec;
+ long long r = rhs.tv_sec * 1000000 + rhs.tv_usec;
+ t %= r;
+ tv_sec = static_cast<long>(t / 1000000);
+ tv_usec = static_cast<long>(t % 1000000);
+ fixup();
+ return *this;
+ }
+
+ friend xtime operator+(xtime x, xtime y) {return x += y;}
+ friend xtime operator-(xtime x, xtime y) {return x -= y;}
+ friend xtime operator%(xtime x, xtime y) {return x %= y;}
+
+ friend bool operator==(xtime x, xtime y)
+ { return (x.tv_sec == y.tv_sec && x.tv_usec == y.tv_usec); }
+
+ friend bool operator<(xtime x, xtime y) {
+ if (x.tv_sec == y.tv_sec)
+ return (x.tv_usec < y.tv_usec);
+ return (x.tv_sec < y.tv_sec);
+ }
+
+ friend bool operator!=(xtime x, xtime y) { return !(x == y); }
+ friend bool operator> (xtime x, xtime y) { return y < x; }
+ friend bool operator<=(xtime x, xtime y) { return !(y < x); }
+ friend bool operator>=(xtime x, xtime y) { return !(x < y); }
+
+ friend std::ostream& operator<<(std::ostream& os, xtime x)
+ {return os << '{' << x.tv_sec << ',' << x.tv_usec << '}';}
+};
+
+class xtime_clock
+{
+public:
+ typedef xtime rep;
+ typedef boost::micro period;
+ typedef boost::chrono::duration<rep, period> duration;
+ typedef boost::chrono::time_point<xtime_clock> time_point;
+
+ static time_point now();
+};
+
+#if defined(BOOST_CHRONO_WINDOWS_API)
+
+namespace
+{
+ //struct timeval {
+ // long tv_sec; /* seconds */
+ // long tv_usec; /* and microseconds */
+ //};
+
+ int gettimeofday(struct timeval * tp, void *)
+ {
+ FILETIME ft;
+ ::GetSystemTimeAsFileTime( &ft ); // never fails
+ long long t = (static_cast<long long>(ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
+ # if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300 // > VC++ 7.0
+ t -= 116444736000000000LL;
+ # else
+ t -= 116444736000000000;
+ # endif
+ t /= 10; // microseconds
+ tp->tv_sec = static_cast<long>( t / 1000000UL);
+ tp->tv_usec = static_cast<long>( t % 1000000UL);
+ return 0;
+ }
+} // unnamed namespace
+
+#endif
+
+
+xtime_clock::time_point
+xtime_clock::now()
+{
+#if defined(BOOST_CHRONO_WINDOWS_API)
+ time_point t(duration(xtime(0)));
+ gettimeofday((timeval*)&t, 0);
+ return t;
+
+#elif defined(BOOST_CHRONO_MAC_API)
+
+ time_point t(duration(xtime(0)));
+ gettimeofday((timeval*)&t, 0);
+ return t;
+
+#elif defined(BOOST_CHRONO_POSIX_API)
+ //time_point t(0,0);
+
+ timespec ts;
+ ::clock_gettime( CLOCK_REALTIME, &ts );
+
+ xtime xt( ts.tv_sec, ts.tv_nsec/1000);
+ return time_point(duration(xt));
+
+#endif // POSIX
+
+}
+
+void test_xtime_clock()
+{
+ using namespace boost::chrono;
+ std::cout << "timeval_demo system clock test\n";
+ std::cout << "sizeof xtime_clock::time_point = " << sizeof(xtime_clock::time_point) << '\n';
+ std::cout << "sizeof xtime_clock::duration = " << sizeof(xtime_clock::duration) << '\n';
+ std::cout << "sizeof xtime_clock::rep = " << sizeof(xtime_clock::rep) << '\n';
+ xtime_clock::duration delay(milliseconds(5));
+ xtime_clock::time_point start = xtime_clock::now();
+ while (xtime_clock::now() - start <= delay)
+ {
+ }
+ xtime_clock::time_point stop = xtime_clock::now();
+ xtime_clock::duration elapsed = stop - start;
+ std::cout << "paused " << nanoseconds(elapsed).count() << " nanoseconds\n";
+}
+
+} // timeval_demo
+
+int main()
+{
+ timeval_demo::test_xtime_clock();
+ return 0;
+}
+

Added: sandbox/chrono/libs/chrono/example/xtime.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/example/xtime.cpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,113 @@
+// xtime.cpp ----------------------------------------------------------//
+
+// Copyright 2008 Howard Hinnant
+// Copyright 2008 Beman Dawes
+// Copyright 2009 Vicente J. Botet Escriba
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+/*
+This code was extracted by Vicente J. Botet Escriba from Beman Dawes time2_demo.cpp which
+was derived by Beman Dawes from Howard Hinnant's time2_demo prototype.
+Many thanks to Howard for making his code available under the Boost license.
+The original code was modified to conform to Boost conventions and to section
+20.9 Time utilities [time] of the C++ committee's working paper N2798.
+See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf.
+
+time2_demo contained this comment:
+
+ Much thanks to Andrei Alexandrescu,
+ Walter Brown,
+ Peter Dimov,
+ Jeff Garland,
+ Terry Golubiewski,
+ Daniel Krügler,
+ Anthony Williams.
+*/
+
+#include <boost/chrono/chrono.hpp>
+#include <boost/type_traits.hpp>
+
+#include <iostream>
+
+#undef min
+#undef max
+
+using namespace boost::chrono;
+
+// Example round_up utility: converts d to To, rounding up for inexact conversions
+// Being able to *easily* write this function is a major feature!
+template <class To, class Rep, class Period>
+To
+round_up(duration<Rep, Period> d)
+{
+ To result = duration_cast<To>(d);
+ if (result < d)
+ ++result;
+ return result;
+}
+
+// demonstrate interaction with xtime-like facility:
+
+using namespace boost::chrono;
+
+struct xtime
+{
+ long sec;
+ unsigned long usec;
+};
+
+template <class Rep, class Period>
+xtime
+to_xtime_truncate(duration<Rep, Period> d)
+{
+ xtime xt;
+ xt.sec = static_cast<long>(duration_cast<seconds>(d).count());
+ xt.usec = static_cast<long>(duration_cast<microseconds>(d - seconds(xt.sec)).count());
+ return xt;
+}
+
+template <class Rep, class Period>
+xtime
+to_xtime_round_up(duration<Rep, Period> d)
+{
+ xtime xt;
+ xt.sec = static_cast<long>(duration_cast<seconds>(d).count());
+ xt.usec = static_cast<unsigned long>(round_up<microseconds>(d - seconds(xt.sec)).count());
+ return xt;
+}
+
+microseconds
+from_xtime(xtime xt)
+{
+ return seconds(xt.sec) + microseconds(xt.usec);
+}
+
+void print(xtime xt)
+{
+ std::cout << '{' << xt.sec << ',' << xt.usec << "}\n";
+}
+
+void test_with_xtime()
+{
+ std::cout << "test_with_xtime\n";
+ xtime xt = to_xtime_truncate(seconds(3) + milliseconds(251));
+ print(xt);
+ milliseconds ms = duration_cast<milliseconds>(from_xtime(xt));
+ std::cout << ms.count() << " milliseconds\n";
+ xt = to_xtime_round_up(ms);
+ print(xt);
+ xt = to_xtime_truncate(seconds(3) + nanoseconds(999));
+ print(xt);
+ xt = to_xtime_round_up(seconds(3) + nanoseconds(999));
+ print(xt);
+}
+
+
+int main()
+{
+ test_with_xtime();
+ return 0;
+}
+

Modified: sandbox/chrono/libs/chrono/src/chrono.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/src/chrono.cpp (original)
+++ sandbox/chrono/libs/chrono/src/chrono.cpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -1,6 +1,7 @@
 // chrono.cpp --------------------------------------------------------------//
 
 // Copyright Beman Dawes 2008
+// Copyright Vicente J. Botet Escriba 2009
 
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt
@@ -23,313 +24,18 @@
 // Windows //
 //----------------------------------------------------------------------------//
 #if defined(BOOST_CHRONO_WINDOWS_API)
-
-#include <windows.h>
-#undef min
-#undef max
-
-namespace
-{
- double get_nanosecs_per_tic()
- {
- LARGE_INTEGER freq;
- if ( !QueryPerformanceFrequency( &freq ) )
- return 0.0L;
- return 1000000000.0L / freq.QuadPart;
- }
-
- const double nanosecs_per_tic = get_nanosecs_per_tic();
-}
-
-namespace boost
-{
-namespace chrono
-{
-
- monotonic_clock::time_point monotonic_clock::now()
- {
-
- LARGE_INTEGER pcount;
- if ( nanosecs_per_tic <= 0.0L || !QueryPerformanceCounter( &pcount ) )
- {
- DWORD cause = (nanosecs_per_tic <= 0.0L ? ERROR_NOT_SUPPORTED : ::GetLastError());
- boost::throw_exception(
- system::system_error( cause, system::system_category, "chrono::monotonic_clock" ));
- }
-
- return time_point(duration(
- static_cast<monotonic_clock::rep>(nanosecs_per_tic * pcount.QuadPart) ));
- }
-
- monotonic_clock::time_point monotonic_clock::now( system::error_code & ec )
- {
- static double nanosecs_per_tic = get_nanosecs_per_tic();
-
- LARGE_INTEGER pcount;
- if ( nanosecs_per_tic <= 0.0L || !QueryPerformanceCounter( &pcount ) )
- {
- DWORD cause = (nanosecs_per_tic <= 0.0L ? ERROR_NOT_SUPPORTED : ::GetLastError());
- ec.assign( cause, system::system_category );
- return time_point(duration(0));
- }
-
- ec.clear();
- return time_point(duration(
- static_cast<monotonic_clock::rep>(nanosecs_per_tic * pcount.QuadPart) ));
- }
-
- system_clock::time_point system_clock::now()
- {
- FILETIME ft;
- ::GetSystemTimeAsFileTime( &ft ); // never fails
- return time_point(duration(
- (static_cast<__int64>( ft.dwHighDateTime ) << 32) | ft.dwLowDateTime));
- }
-
- system_clock::time_point system_clock::now( system::error_code & ec )
- {
- FILETIME ft;
- ::GetSystemTimeAsFileTime( &ft ); // never fails
- ec.clear();
- return time_point(duration(
- (static_cast<__int64>( ft.dwHighDateTime ) << 32) | ft.dwLowDateTime));
- }
-
- std::time_t system_clock::to_time_t(const system_clock::time_point& t)
- {
- __int64 temp = t.time_since_epoch().count();
-
- # if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300 // > VC++ 7.0
- temp -= 116444736000000000LL; // delta from epoch in microseconds
- # else
- temp -= 116444736000000000;
- # endif
-
- temp /= 10000000;
- return static_cast<std::time_t>( temp );
- }
-
- system_clock::time_point system_clock::from_time_t(std::time_t t)
- {
- __int64 temp = t;
- temp *= 10000000;
-
- # if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300 // > VC++ 7.0
- temp += 116444736000000000LL;
- # else
- temp += 116444736000000000;
- # endif
-
- return time_point(duration(temp));
- }
-
-} // namespace chrono
-} // namespace boost
+#include "win/chrono.cpp"
 
 //----------------------------------------------------------------------------//
 // Mac //
 //----------------------------------------------------------------------------//
 #elif defined(BOOST_CHRONO_MAC_API)
-
-#include <sys/time.h> //for gettimeofday and timeval
-#include <mach/mach_time.h> // mach_absolute_time, mach_timebase_info_data_t
-
-namespace boost
-{
-namespace chrono
-{
-
-// system_clock
-
-// gettimeofday is the most precise "system time" available on this platform.
-// It returns the number of microseconds since New Years 1970 in a struct called timeval
-// which has a field for seconds and a field for microseconds.
-// Fill in the timeval and then convert that to the time_point
-system_clock::time_point
-system_clock::now()
-{
- timeval tv;
- gettimeofday(&tv, 0);
- return time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec));
-}
-
-system_clock::time_point
-system_clock::now(system::error_code & ec)
-{
- timeval tv;
- gettimeofday(&tv, 0);
- ec.clear();
- return time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec));
-}
-
-// Take advantage of the fact that on this platform time_t is nothing but
-// an integral count of seconds since New Years 1970 (same epoch as timeval).
-// Just get the duration out of the time_point and truncate it to seconds.
-time_t
-system_clock::to_time_t(const time_point& t)
-{
- return time_t(duration_cast<seconds>(t.time_since_epoch()).count());
-}
-
-// Just turn the time_t into a count of seconds and construct a time_point with it.
-system_clock::time_point
-system_clock::from_time_t(time_t t)
-{
- return system_clock::time_point(seconds(t));
-}
-
-// monotonic_clock
-
-// Note, in this implementation monotonic_clock and high_resolution_clock
-// are the same clock. They are both based on mach_absolute_time().
-// mach_absolute_time() * MachInfo.numer / MachInfo.denom is the number of
-// nanoseconds since the computer booted up. MachInfo.numer and MachInfo.denom
-// are run time constants supplied by the OS. This clock has no relationship
-// to the Gregorian calendar. It's main use is as a high resolution timer.
-
-// MachInfo.numer / MachInfo.denom is often 1 on the latest equipment. Specialize
-// for that case as an optimization.
-static
-monotonic_clock::rep
-monotonic_simplified()
-{
- return mach_absolute_time();
-}
-
-static
-double
-compute_monotonic_factor()
-{
- mach_timebase_info_data_t MachInfo;
- mach_timebase_info(&MachInfo);
- return static_cast<double>(MachInfo.numer) / MachInfo.denom;
-}
-
-static
-monotonic_clock::rep
-monotonic_full()
-{
- static const double factor = compute_monotonic_factor();
- return static_cast<monotonic_clock::rep>(mach_absolute_time() * factor);
-}
-
-typedef monotonic_clock::rep (*FP)();
-
-static
-FP
-init_monotonic_clock()
-{
- mach_timebase_info_data_t MachInfo;
- mach_timebase_info(&MachInfo);
- if (MachInfo.numer == MachInfo.denom)
- return &monotonic_simplified;
- return &monotonic_full;
-}
-
-monotonic_clock::time_point
-monotonic_clock::now()
-{
- static FP fp = init_monotonic_clock();
- return time_point(duration(fp()));
-}
-
-} // namespace chrono
-} // namespace boost
+#include "mac/chrono.cpp"
 
 //----------------------------------------------------------------------------//
 // POSIX //
 //----------------------------------------------------------------------------//
 #elif defined(BOOST_CHRONO_POSIX_API)
-
-#include <time.h> // for clock_gettime
-
-namespace boost
-{
-namespace chrono
-{
-
- //system_clock::time_point system_clock::now()
- //{
- // timeval tod;
- // ::gettimeofday( &tod, 0 );
- //
- // return time_point(duration(
- // (static_cast<system_clock::rep>( tod.tv_sec ) * 1000000) + tod.tv_usec));
- //}
-
- #ifndef CLOCK_REALTIME
- # error <time.h> does not supply CLOCK_REALTIME
- #endif
-
- system_clock::time_point system_clock::now()
- {
- timespec ts;
- if ( ::clock_gettime( CLOCK_REALTIME, &ts ) )
- {
- boost::throw_exception(
- system::system_error( errno, system::system_category, "chrono::system_clock" ));
- }
-
- return time_point(duration(
- static_cast<system_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
- }
-
- system_clock::time_point system_clock::now(system::error_code & ec)
- {
- timespec ts;
- if ( ::clock_gettime( CLOCK_REALTIME, &ts ) )
- {
- ec.assign( errno, system::system_category );
- return time_point();
- }
-
- ec.clear();
- return time_point(duration(
- static_cast<system_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
- }
-
- std::time_t system_clock::to_time_t(const system_clock::time_point& t)
- {
- return static_cast<std::time_t>( t.time_since_epoch().count() / 1000000000 );
- }
-
- system_clock::time_point system_clock::from_time_t(std::time_t t)
- {
- return time_point(duration(static_cast<system_clock::rep>(t) * 1000000000));
- }
-
- #ifndef CLOCK_MONOTONIC
- # error <time.h> does not supply CLOCK_MONOTONIC
- #endif
-
- monotonic_clock::time_point monotonic_clock::now()
- {
- timespec ts;
- if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) )
- {
- boost::throw_exception(
- system::system_error( errno, system::system_category, "chrono::monotonic_clock" ));
- }
-
- return time_point(duration(
- static_cast<monotonic_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
- }
-
- monotonic_clock::time_point monotonic_clock::now(system::error_code & ec)
- {
- timespec ts;
- if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) )
- {
- ec.assign( errno, system::system_category );
- return time_point();
- }
-
- ec.clear();
- return time_point(duration(
- static_cast<monotonic_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
- }
-
-} // namespace chrono
-} // namespace boost
+#include "posix/chrono.cpp"
 
 #endif // POSIX

Added: sandbox/chrono/libs/chrono/src/mac/chrono.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/src/mac/chrono.cpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,180 @@
+// mac/chrono.cpp --------------------------------------------------------------//
+
+// Copyright Beman Dawes 2008
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+
+//----------------------------------------------------------------------------//
+// Mac //
+//----------------------------------------------------------------------------//
+
+#include <sys/time.h> //for gettimeofday and timeval
+#include <mach/mach_time.h> // mach_absolute_time, mach_timebase_info_data_t
+
+namespace boost
+{
+namespace chrono
+{
+
+// system_clock
+
+// gettimeofday is the most precise "system time" available on this platform.
+// It returns the number of microseconds since New Years 1970 in a struct called timeval
+// which has a field for seconds and a field for microseconds.
+// Fill in the timeval and then convert that to the time_point
+system_clock::time_point
+system_clock::now()
+{
+ timeval tv;
+ gettimeofday(&tv, 0);
+ return time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec));
+}
+
+system_clock::time_point
+system_clock::now(system::error_code & ec)
+{
+ timeval tv;
+ gettimeofday(&tv, 0);
+ ec.clear();
+ return time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec));
+}
+
+// Take advantage of the fact that on this platform time_t is nothing but
+// an integral count of seconds since New Years 1970 (same epoch as timeval).
+// Just get the duration out of the time_point and truncate it to seconds.
+time_t
+system_clock::to_time_t(const time_point& t)
+{
+ return time_t(duration_cast<seconds>(t.time_since_epoch()).count());
+}
+
+// Just turn the time_t into a count of seconds and construct a time_point with it.
+system_clock::time_point
+system_clock::from_time_t(time_t t)
+{
+ return system_clock::time_point(seconds(t));
+}
+
+// monotonic_clock
+
+// Note, in this implementation monotonic_clock and high_resolution_clock
+// are the same clock. They are both based on mach_absolute_time().
+// mach_absolute_time() * MachInfo.numer / MachInfo.denom is the number of
+// nanoseconds since the computer booted up. MachInfo.numer and MachInfo.denom
+// are run time constants supplied by the OS. This clock has no relationship
+// to the Gregorian calendar. It's main use is as a high resolution timer.
+
+// MachInfo.numer / MachInfo.denom is often 1 on the latest equipment. Specialize
+// for that case as an optimization.
+static
+monotonic_clock::rep
+monotonic_simplified()
+{
+ return mach_absolute_time();
+}
+
+static
+monotonic_clock::rep
+monotonic_simplifie_ec(system::error_code & ec)
+{
+ return mach_absolute_time();
+}
+
+
+static
+double
+compute_monotonic_factor(kern_return_t& err)
+{
+ mach_timebase_info_data_t MachInfo;
+ err = mach_timebase_info(&MachInfo);
+ if( err != 0 ) {
+ return 0;
+ }
+ return static_cast<double>(MachInfo.numer) / MachInfo.denom;
+}
+
+static
+monotonic_clock::rep
+monotonic_full()
+{
+ static kern_return_t err;
+ static const double factor = compute_monotonic_factor(err);
+ if (err != 0)
+ boost::throw_exception(
+ system::system_error( err, system::system_category, "chrono::monotonic_clock" ));
+ return static_cast<monotonic_clock::rep>(mach_absolute_time() * factor);
+}
+
+static
+monotonic_clock::rep
+monotonic_full_ec(system::error_code & ec)
+{
+ static kern_return_t err;
+ static const double factor = compute_monotonic_factor(err);
+ if (err != 0) {
+ ec.assign( errno, system::system_category );
+ return monotonic_clock::rep();
+ }
+ return static_cast<monotonic_clock::rep>(mach_absolute_time() * factor);
+}
+
+typedef monotonic_clock::rep (*FP)();
+typedef monotonic_clock::rep (*FP_ec)(system::error_code &);
+
+
+static
+FP_ec
+init_monotonic_clock(kern_return_t & err)
+{
+ mach_timebase_info_data_t MachInfo;
+ err = mach_timebase_info(&MachInfo);
+ if( err != 0 ) {
+ return 0;
+ }
+
+ if (MachInfo.numer == MachInfo.denom)
+ return &monotonic_simplified_ec;
+ return &monotonic_full_ec;
+}
+
+static
+FP_ec
+init_monotonic_clock_ec(kern_return_t & err)
+{
+ mach_timebase_info_data_t MachInfo;
+ err = mach_timebase_info(&MachInfo);
+ if( err != 0 ) {
+ return 0;
+ }
+
+ if (MachInfo.numer == MachInfo.denom)
+ return &monotonic_simplified_ec;
+ return &monotonic_full_ec;
+}
+
+monotonic_clock::time_point
+monotonic_clock::now()
+{
+ static kern_return_t err;
+ static FP fp = init_monotonic_clock(err);
+ if( err != 0 ) boost::throw_exception(
+ system::system_error( err, system::system_category, "chrono::monotonic_clock" ));
+ return time_point(duration(fp()));
+}
+
+monotonic_clock::time_point
+monotonic_clock::now(system::error_code & ec)
+{
+ static kern_return_t err;
+ static FP_ec fp = init_monotonic_clock(err);
+ if( err != 0 ) {
+ ec.assign( err, system::system_category );
+ return time_point();
+ }
+ return time_point(duration(fp(ec)));
+}
+
+} // namespace chrono
+} // namespace boost

Added: sandbox/chrono/libs/chrono/src/mac/process_clock.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/src/mac/process_clock.cpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,86 @@
+// boost process_timer.cpp -----------------------------------------------------------//
+
+// Copyright Beman Dawes 1994, 2006, 2008
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// See http://www.boost.org/libs/chrono for documentation.
+
+//--------------------------------------------------------------------------------------//
+
+// define BOOST_CHRONO_SOURCE so that <boost/chrono/config.hpp> knows
+// the library is being built (possibly exporting rather than importing code)
+#define BOOST_CHRONO_SOURCE
+
+#include <boost/chrono/config.hpp>
+#include <boost/chrono/process_times.hpp>
+#include <cassert>
+
+#include <sys/time.h> //for gettimeofday and timeval
+# include <unistd.h>
+
+namespace
+{
+ long tick_factor() // multiplier to convert ticks
+ // to nanoseconds; -1 if unknown
+ {
+ static long factor = 0;
+ if ( !factor )
+ {
+ if ( (factor = ::sysconf( _SC_CLK_TCK )) <= 0 )
+ factor = -1;
+ else
+ {
+ assert( factor <= 1000000l ); // doesn't handle large ticks
+ factor = 1000000l / factor; // compute factor
+ if ( !factor ) factor = -1;
+ }
+ }
+ return factor;
+ }
+}
+
+#else
+# error unknown API
+#endif
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ void process_clock::now( process_times & times_, system::error_code & ec )
+ {
+
+ tms tm;
+ clock_t c = ::times( &tm );
+ if ( c == -1 ) // error
+ {
+ assert( 0 && "error handling not implemented yet" );
+
+ ec = system::error_code( errno, system::system_category );
+ times_.real = times_.system = times_.user = nanoseconds(-1);
+ }
+ else
+ {
+ times_.real = microseconds(c);
+ times_.system = microseconds(tm.tms_stime + tm.tms_cstime);
+ times_.user = microseconds(tm.tms_utime + tm.tms_cutime);
+ if ( tick_factor() != -1 )
+ {
+ times_.real *= tick_factor();
+ times_.user *= tick_factor();
+ times_.system *= tick_factor();
+ }
+ else
+ {
+ assert( 0 && "error handling not implemented yet" );
+ ec = system::error_code( errno, system::system_category );
+ times_.real = times_.user = times_.system = nanoseconds(-1);
+ }
+ }
+
+ }
+ } // namespace chrono
+} // namespace boost

Added: sandbox/chrono/libs/chrono/src/posix/chrono.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/src/posix/chrono.cpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,91 @@
+// posix/chrono.cpp --------------------------------------------------------------//
+
+// Copyright Beman Dawes 2008
+// Copyright Vicente J. Botet Escriba 2009
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+//----------------------------------------------------------------------------//
+// POSIX //
+//----------------------------------------------------------------------------//
+
+
+#include <time.h> // for clock_gettime
+
+namespace boost
+{
+namespace chrono
+{
+
+ system_clock::time_point system_clock::now()
+ {
+ timespec ts;
+ if ( ::clock_gettime( CLOCK_REALTIME, &ts ) )
+ {
+ boost::throw_exception(
+ system::system_error( errno, system::system_category, "chrono::system_clock" ));
+ }
+
+ return time_point(duration(
+ static_cast<system_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
+ }
+
+ system_clock::time_point system_clock::now(system::error_code & ec)
+ {
+ timespec ts;
+ if ( ::clock_gettime( CLOCK_REALTIME, &ts ) )
+ {
+ ec.assign( errno, system::system_category );
+ return time_point();
+ }
+
+ ec.clear();
+ return time_point(duration(
+ static_cast<system_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
+ }
+
+ std::time_t system_clock::to_time_t(const system_clock::time_point& t)
+ {
+ return static_cast<std::time_t>( t.time_since_epoch().count() / 1000000000 );
+ }
+
+ system_clock::time_point system_clock::from_time_t(std::time_t t)
+ {
+ return time_point(duration(static_cast<system_clock::rep>(t) * 1000000000));
+ }
+
+#ifdef BOOST_CHRONO_HAS_CLOCK_MONOTONIC
+
+ monotonic_clock::time_point monotonic_clock::now()
+ {
+ timespec ts;
+ if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) )
+ {
+ boost::throw_exception(
+ system::system_error( errno, system::system_category, "chrono::monotonic_clock" ));
+ }
+
+ return time_point(duration(
+ static_cast<monotonic_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
+ }
+
+ monotonic_clock::time_point monotonic_clock::now(system::error_code & ec)
+ {
+ timespec ts;
+ if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) )
+ {
+ ec.assign( errno, system::system_category );
+ return time_point();
+ }
+
+ ec.clear();
+ return time_point(duration(
+ static_cast<monotonic_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
+ }
+#endif
+
+} // namespace chrono
+} // namespace boost
+
+

Added: sandbox/chrono/libs/chrono/src/posix/process_clock.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/src/posix/process_clock.cpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,83 @@
+// boost process_timer.cpp -----------------------------------------------------------//
+
+// Copyright Beman Dawes 1994, 2006, 2008
+// Copyright Vicente J. Botet Escriba 2009
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// See http://www.boost.org/libs/chrono for documentation.
+
+//--------------------------------------------------------------------------------------//
+
+// define BOOST_CHRONO_SOURCE so that <boost/chrono/config.hpp> knows
+// the library is being built (possibly exporting rather than importing code)
+#define BOOST_CHRONO_SOURCE
+
+#include <boost/chrono/config.hpp>
+#include <boost/chrono/process_times.hpp>
+#include <cassert>
+
+# include <sys/times.h>
+# include <unistd.h>
+
+namespace
+{
+ long tick_factor() // multiplier to convert ticks
+ // to nanoseconds; -1 if unknown
+ {
+ static long factor = 0;
+ if ( !factor )
+ {
+ if ( (factor = ::sysconf( _SC_CLK_TCK )) <= 0 )
+ factor = -1;
+ else
+ {
+ assert( factor <= 1000000l ); // doesn't handle large ticks
+ factor = 1000000l / factor; // compute factor
+ if ( !factor ) factor = -1;
+ }
+ }
+ return factor;
+ }
+}
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ void process_clock::now( process_times & times_, system::error_code & ec )
+ {
+
+ tms tm;
+ clock_t c = ::times( &tm );
+ if ( c == -1 ) // error
+ {
+ assert( 0 && "error handling not implemented yet" );
+
+ ec = system::error_code( errno, system::system_category );
+ times_.real = times_.system = times_.user = nanoseconds(-1);
+ }
+ else
+ {
+ times_.real = microseconds(c);
+ times_.system = microseconds(tm.tms_stime + tm.tms_cstime);
+ times_.user = microseconds(tm.tms_utime + tm.tms_cutime);
+ if ( tick_factor() != -1 )
+ {
+ times_.real *= tick_factor();
+ times_.user *= tick_factor();
+ times_.system *= tick_factor();
+ }
+ else
+ {
+ assert( 0 && "error handling not implemented yet" );
+ ec = system::error_code( errno, system::system_category );
+ times_.real = times_.user = times_.system = nanoseconds(-1);
+ }
+ }
+
+ }
+ } // namespace chrono
+} // namespace boost

Modified: sandbox/chrono/libs/chrono/src/process_clock.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/src/process_clock.cpp (original)
+++ sandbox/chrono/libs/chrono/src/process_clock.cpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -17,99 +17,24 @@
 #include <boost/chrono/process_times.hpp>
 #include <cassert>
 
+//----------------------------------------------------------------------------//
+// Windows //
+//----------------------------------------------------------------------------//
 #if defined(BOOST_CHRONO_WINDOWS_API)
-# include <windows.h>
+#include "win/process_clock.cpp"
+
+//----------------------------------------------------------------------------//
+// Mac //
+//----------------------------------------------------------------------------//
+#elif defined(BOOST_CHRONO_MAC_API)
+#include "mac/process_clock.cpp"
+
+//----------------------------------------------------------------------------//
+// POSIX //
+//----------------------------------------------------------------------------//
 #elif defined(BOOST_CHRONO_POSIX_API)
-# include <sys/times.h>
-# include <unistd.h>
+#include "posix/process_clock.cpp"
+
+#endif // POSIX
+
 
-namespace
-{
- long tick_factor() // multiplier to convert ticks
- // to nanoseconds; -1 if unknown
- {
- static long factor = 0;
- if ( !factor )
- {
- if ( (factor = ::sysconf( _SC_CLK_TCK )) <= 0 )
- factor = -1;
- else
- {
- assert( factor <= 1000000l ); // doesn't handle large ticks
- factor = 1000000l / factor; // compute factor
- if ( !factor ) factor = -1;
- }
- }
- return factor;
- }
-}
-
-#else
-# error unknown API
-#endif
-
-namespace boost
-{
- namespace chrono
- {
-
- void process_clock::now( process_times & times_, system::error_code & ec )
- {
-
-# if defined(BOOST_CHRONO_WINDOWS_API)
-
- // note that Windows uses 100 nanosecond ticks for FILETIME
- FILETIME creation, exit, user_time, system_time;
-
- times_.real = duration( monotonic_clock::now().time_since_epoch().count() );
-
- if ( ::GetProcessTimes( ::GetCurrentProcess(), &creation, &exit,
- &system_time, &user_time ) )
- {
- times_.user = duration(
- ((static_cast<time_point::rep>(user_time.dwHighDateTime) << 32)
- | user_time.dwLowDateTime) * 100 );
-
- times_.system = duration(
- ((static_cast<time_point::rep>(system_time.dwHighDateTime) << 32)
- | system_time.dwLowDateTime) * 100 );
- }
- else
- {
- assert( 0 && "error handling not implemented yet" );
- //ec = error_code( ::GetLastError(), native_ecat );
- //times_.real = times_.system = times_.user = nanoseconds(-1);
- }
-
-# else // BOOST_CHRONO_POSIX_API
- tms tm;
- clock_t c = ::times( &tm );
- if ( c == -1 ) // error
- {
- assert( 0 && "error handling not implemented yet" );
-
- ec = system::error_code( errno, system::system_category );
- times_.real = times_.system = times_.user = nanoseconds(-1);
- }
- else
- {
- times_.real = microseconds(c);
- times_.system = microseconds(tm.tms_stime + tm.tms_cstime);
- times_.user = microseconds(tm.tms_utime + tm.tms_cutime);
- if ( tick_factor() != -1 )
- {
- times_.real *= tick_factor();
- times_.user *= tick_factor();
- times_.system *= tick_factor();
- }
- else
- {
- assert( 0 && "error handling not implemented yet" );
- ec = system::error_code( errno, system::system_category );
- times_.real = times_.user = times_.system = nanoseconds(-1);
- }
- }
-# endif
- }
- } // namespace chrono
-} // namespace boost

Added: sandbox/chrono/libs/chrono/src/win/chrono.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/src/win/chrono.cpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,113 @@
+// win/chrono.cpp --------------------------------------------------------------//
+
+// Copyright Beman Dawes 2008
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+//----------------------------------------------------------------------------//
+// Windows //
+//----------------------------------------------------------------------------//
+
+#include <windows.h>
+#undef min
+#undef max
+
+namespace
+{
+ double get_nanosecs_per_tic()
+ {
+ LARGE_INTEGER freq;
+ if ( !QueryPerformanceFrequency( &freq ) )
+ return 0.0L;
+ return 1000000000.0L / freq.QuadPart;
+ }
+
+ const double nanosecs_per_tic = get_nanosecs_per_tic();
+}
+
+namespace boost
+{
+namespace chrono
+{
+
+ monotonic_clock::time_point monotonic_clock::now()
+ {
+
+ LARGE_INTEGER pcount;
+ if ( nanosecs_per_tic <= 0.0L || !QueryPerformanceCounter( &pcount ) )
+ {
+ DWORD cause = (nanosecs_per_tic <= 0.0L ? ERROR_NOT_SUPPORTED : ::GetLastError());
+ boost::throw_exception(
+ system::system_error( cause, system::system_category, "chrono::monotonic_clock" ));
+ }
+
+ return time_point(duration(
+ static_cast<monotonic_clock::rep>(nanosecs_per_tic * pcount.QuadPart) ));
+ }
+
+ monotonic_clock::time_point monotonic_clock::now( system::error_code & ec )
+ {
+ static double nanosecs_per_tic = get_nanosecs_per_tic();
+
+ LARGE_INTEGER pcount;
+ if ( nanosecs_per_tic <= 0.0L || !QueryPerformanceCounter( &pcount ) )
+ {
+ DWORD cause = (nanosecs_per_tic <= 0.0L ? ERROR_NOT_SUPPORTED : ::GetLastError());
+ ec.assign( cause, system::system_category );
+ return time_point(duration(0));
+ }
+
+ ec.clear();
+ return time_point(duration(
+ static_cast<monotonic_clock::rep>(nanosecs_per_tic * pcount.QuadPart) ));
+ }
+
+ system_clock::time_point system_clock::now()
+ {
+ FILETIME ft;
+ ::GetSystemTimeAsFileTime( &ft ); // never fails
+ return time_point(duration(
+ (static_cast<__int64>( ft.dwHighDateTime ) << 32) | ft.dwLowDateTime));
+ }
+
+ system_clock::time_point system_clock::now( system::error_code & ec )
+ {
+ FILETIME ft;
+ ::GetSystemTimeAsFileTime( &ft ); // never fails
+ ec.clear();
+ return time_point(duration(
+ (static_cast<__int64>( ft.dwHighDateTime ) << 32) | ft.dwLowDateTime));
+ }
+
+ std::time_t system_clock::to_time_t(const system_clock::time_point& t)
+ {
+ __int64 temp = t.time_since_epoch().count();
+
+ # if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300 // > VC++ 7.0
+ temp -= 116444736000000000LL; // delta from epoch in microseconds
+ # else
+ temp -= 116444736000000000;
+ # endif
+
+ temp /= 10000000;
+ return static_cast<std::time_t>( temp );
+ }
+
+ system_clock::time_point system_clock::from_time_t(std::time_t t)
+ {
+ __int64 temp = t;
+ temp *= 10000000;
+
+ # if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300 // > VC++ 7.0
+ temp += 116444736000000000LL;
+ # else
+ temp += 116444736000000000;
+ # endif
+
+ return time_point(duration(temp));
+ }
+
+} // namespace chrono
+} // namespace boost
+

Added: sandbox/chrono/libs/chrono/src/win/process_clock.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/src/win/process_clock.cpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -0,0 +1,55 @@
+// boost process_timer.cpp -----------------------------------------------------------//
+
+// Copyright Beman Dawes 1994, 2006, 2008
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// See http://www.boost.org/libs/chrono for documentation.
+
+//--------------------------------------------------------------------------------------//
+
+// define BOOST_CHRONO_SOURCE so that <boost/chrono/config.hpp> knows
+// the library is being built (possibly exporting rather than importing code)
+#define BOOST_CHRONO_SOURCE
+
+#include <boost/chrono/config.hpp>
+#include <boost/chrono/process_times.hpp>
+#include <cassert>
+
+# include <windows.h>
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ void process_clock::now( process_times & times_, system::error_code & ec )
+ {
+
+ // note that Windows uses 100 nanosecond ticks for FILETIME
+ FILETIME creation, exit, user_time, system_time;
+
+ times_.real = duration( monotonic_clock::now().time_since_epoch().count() );
+
+ if ( ::GetProcessTimes( ::GetCurrentProcess(), &creation, &exit,
+ &system_time, &user_time ) )
+ {
+ times_.user = duration(
+ ((static_cast<time_point::rep>(user_time.dwHighDateTime) << 32)
+ | user_time.dwLowDateTime) * 100 );
+
+ times_.system = duration(
+ ((static_cast<time_point::rep>(system_time.dwHighDateTime) << 32)
+ | system_time.dwLowDateTime) * 100 );
+ }
+ else
+ {
+ assert( 0 && "error handling not implemented yet" );
+ //ec = error_code( ::GetLastError(), native_ecat );
+ //times_.real = times_.system = times_.user = nanoseconds(-1);
+ }
+
+ }
+ } // namespace chrono
+} // namespace boost

Modified: sandbox/chrono/libs/chrono/test/Jamfile.v2
==============================================================================
--- sandbox/chrono/libs/chrono/test/Jamfile.v2 (original)
+++ sandbox/chrono/libs/chrono/test/Jamfile.v2 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -9,27 +9,51 @@
 
 project
     : requirements
-# <library>/boost/chrono//boost_chrono
+ #<library>/boost/chrono//boost_chrono
+ <library>/boost/system//boost_system/<link>static
+ #<library>../build//boost_chrono/<link>static
+ <include>/boost_1_39_0
+ <include>../../..
       <toolset>msvc:<asynch-exceptions>on
     ;
 
- test-suite "chrono"
- :
-# [ run ../example/time2_demo.cpp
-# : # command line
-# : # requirements
-# <link>static
-# ]
-# [ run ../example/time2_demo.cpp ../../system/build
-# : : : : time2_demo_dll
-# ]
-# [ run run_timer_test.cpp
-# : : : <link>static
-# ]
-# [ run run_timer_test.cpp ../../system/build
-# : : : : run_timer_test_dll
-# ]
-# [ run ../example/run_timer_example.cpp ../../system/build
-# ]
- [ compile-fail ratio_fail_test1.cpp ]
- ;
+# test-suite "common_type"
+# :
+# [ run ../example/run_timer_example.cpp ]
+# ;
+
+ test-suite "ratio"
+ :
+ [ run ratio_test.cpp ]
+ [ compile-fail ratio_fail_test1.cpp ]
+ ;
+
+
+ test-suite "chrono"
+ :
+ [ run chrono_unit_test.cpp ../build//boost_chrono/<link>static ]
+ [ run explore_limits.cpp ../build//boost_chrono/<link>static ]
+ [ run test_duration.cpp ../build//boost_chrono/<link>static ]
+ [ run test_system_clock.cpp ../build//boost_chrono/<link>static ]
+ [ run miscellaneous.cpp ../build//boost_chrono/<link>static ]
+ [ run test_special_values.cpp ../build//boost_chrono/<link>static ]
+ [ run manipulate_clock_object.cpp ../build//boost_chrono/<link>static ]
+ [ run ../example/cycle_count.cpp ../build//boost_chrono/<link>static ]
+ [ run ../example/runtime_resolution.cpp ../build//boost_chrono/<link>static ]
+ [ run ../example/xtime.cpp ../build//boost_chrono/<link>static ]
+ [ run ../example/saturating.cpp ../build//boost_chrono/<link>static ]
+ [ run ../example/min_time_point.cpp ../build//boost_chrono/<link>static ]
+ [ run ../example/i_dont_like_the_default_duration_behavior.cpp ../build//boost_chrono/<link>static ]
+ [ run ../example/simulated_thread_interface_demo.cpp ../build//boost_chrono/<link>static ]
+ [ run ../example/timeval_demo.cpp ../build//boost_chrono/<link>static ]
+ ;
+
+ test-suite "timer"
+ :
+ [ run ../example/run_timer_example.cpp ../build//boost_chrono/<link>static ]
+ [ run run_timer_test.cpp ../build//boost_chrono/<link>static
+ : : : ]
+ #[ run run_timer_test.cpp ../build//boost_chrono/<link>static
+ # : : : : run_timer_test_dll
+ #]
+ ;

Modified: sandbox/chrono/libs/chrono/test/chrono_unit_test.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/test/chrono_unit_test.cpp (original)
+++ sandbox/chrono/libs/chrono/test/chrono_unit_test.cpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -5,7 +5,7 @@
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt
 
-#include <boost/chrono.hpp>
+#include <boost/chrono/chrono.hpp>
 #include <iostream>
 
 

Modified: sandbox/chrono/libs/chrono/test/ratio_fail_test1.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/test/ratio_fail_test1.cpp (original)
+++ sandbox/chrono/libs/chrono/test/ratio_fail_test1.cpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -7,7 +7,12 @@
 
 #include <boost/ratio.hpp>
 
+#if 0
+typedef boost::ratio<0x7FFFFFFF, 0x7FFFFFF0> R1;
+typedef boost::ratio<0x7FFFFFFF, 0x7FFFFFF0> R2;
+typedef boost::ratio_multiply<R1, R2>::type RT;
+#else
 typedef boost::ratio<0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFF0> R1;
 typedef boost::ratio<0x7FFFFFFFFFFFFFFE, 0x7FFFFFFFFFFFFFF0> R2;
 typedef boost::ratio_multiply<R1, R2>::type RT;
-
+#endif

Modified: sandbox/chrono/libs/chrono/test/ratio_test.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/test/ratio_test.cpp (original)
+++ sandbox/chrono/libs/chrono/test/ratio_test.cpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -9,10 +9,33 @@
 #include <boost/ratio.hpp>
 #include <boost/chrono/chrono.hpp>
 #include <iostream>
+#include <complex>
+
+#if 0
+template <class T, class U>
+typename boost::common_type<std::complex<T>, std::complex<U> >::type
+operator+(std::complex<T>, std::complex<U>);
+#else
+template <class T, class U>
+std::complex<typename boost::common_type<T, U>::type>
+operator+(std::complex<T>, std::complex<U>);
+#endif
+
+typedef boost::ratio<5, 3> five_thirds; // five_thirds::num == 5, five_thirds::den == 3
+typedef boost::ratio<25, 15> also_five_thirds; // also_five_thirds::num == 5, also_five_thirds::den == 3
+typedef boost::ratio_divide<five_thirds, also_five_thirds>::type one; // one::num == 1, one::den == 1
+
+
+typedef boost::ratio_multiply<boost::ratio<5>, boost::giga>::type _5giga; // _5giga::num == 5000000000, _5giga::den == 1
+typedef boost::ratio_multiply<boost::ratio<5>, boost::nano>::type _5nano; // _5nano::num == 1, _5nano::den == 200000000
 
 // Test the case described in library working group issue 948.
 
+#if 0
 typedef boost::ratio<0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFF0> R1;
+#else
+typedef boost::ratio<0x7FFFFFFF, 0x7FFFFFF0> R1;
+#endif
 typedef boost::ratio<8, 7> R2;
 typedef boost::ratio_multiply<R1, R2>::type RT;
 
@@ -85,6 +108,8 @@
 {
     double q_;
 public:
+ typedef R1 time_dim;
+ typedef R2 distance_dim;
     quantity() : q_(1) {}
 
     double get() const {return q_;}
@@ -134,6 +159,9 @@
 typedef quantity<boost::ratio<-1>, boost::ratio<1> > Speed; // meter/second
 typedef quantity<boost::ratio<-2>, boost::ratio<1> > Acceleration; // meter/second^2
 
+ typedef User1::quantity<boost::ratio_subtract<boost::ratio<0>, boost::ratio<1> >::type,
+ boost::ratio_subtract<boost::ratio<1>, boost::ratio<0> >::type > RR;
+
 template <class R1, class R2, class R3, class R4>
 quantity<typename boost::ratio_subtract<R1, R3>::type, typename boost::ratio_subtract<R2, R4>::type>
 operator/(const quantity<R1, R2>& x, const quantity<R3, R4>& y)
@@ -188,6 +216,23 @@
 // Though input can be arbitrary (but type-safe) units, output is always in SI-units
 // (a limitation of the simplified Units lib demoed here).
 
+#if 0
+ typedef quantity<typename boost::ratio_subtract<R1, R3>::type, typename boost::ratio_subtract<R2, R4>::type> R;
+ R r;
+ r.set(x.get() / y.get());
+ return r;
+typedef quantity<boost::ratio<1>, boost::ratio<0> > Time; // second
+typedef quantity<boost::ratio<0>, boost::ratio<1> > Distance; // meter
+ typedef R1 time_dim;
+ typedef R2 distance_dim;
+}
+#endif
+
+ typedef User1::quantity<boost::ratio_subtract<boost::ratio<0>, boost::ratio<1> >::type,
+ boost::ratio_subtract<boost::ratio<1>, boost::ratio<0> >::type > RR;
+ //typedef User1::quantity<boost::ratio_subtract<boost::ratio<1>, boost::ratio<0> >::type,
+ // boost::ratio_subtract<boost::ratio<0>, boost::ratio<1> >::type > RR;
+
 int main()
 {
     std::cout << "*************\n";
@@ -195,6 +240,14 @@
     std::cout << "*************\n";
     User1::Distance d( User1::mile(110) );
     User1::Time t( boost::chrono::hours(2) );
+
+ //typedef User1::quantity<boost::ratio_subtract<User1::Distance::time_dim, User1::Time::time_dim >::type,
+ // boost::ratio_subtract<User1::Distance::distance_dim, User1::Time::distance_dim >::type > R;
+ User1::RR r=d / t;
+ //r.set(d.get() / t.get());
+
+ User1::Speed rc= r;
+
     User1::Speed s = d / t;
     std::cout << "Speed = " << s.get() << " meters/sec\n";
     User1::Acceleration a = User1::Distance( User1::foot(32.2) ) / User1::Time() / User1::Time();

Modified: sandbox/chrono/libs/chrono/test/run_timer_test.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/test/run_timer_test.cpp (original)
+++ sandbox/chrono/libs/chrono/test/run_timer_test.cpp 2009-12-08 07:53:58 EST (Tue, 08 Dec 2009)
@@ -1,6 +1,7 @@
 // boost run_timer_test.cpp -----------------------------------------------------//
 
 // Copyright Beman Dawes 2006, 2008
+// Copyright 2009 Vicente J. Botet Escriba
 
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt
@@ -45,7 +46,7 @@
     }
     return result;
   }
-
+
   void run_timer_constructor_overload_test()
   {
     // exercise each supported combination of constructor arguments
@@ -94,7 +95,9 @@
     timeout_in_clock_t += (timeout_in_secs * CLOCKS_PER_SEC);
 
     boost::chrono::system_timer sys;
+#ifdef BOOST_CHRONO_HAS_CLOCK_MONOTONIC
     boost::chrono::monotonic_timer mono;
+#endif
     boost::chrono::high_resolution_timer hires;
     boost::chrono::process_timer process;
     
@@ -105,7 +108,9 @@
     } while ( now < timeout_in_clock_t );
 
     boost::chrono::system_timer::duration sys_dur = sys.elapsed();
+#ifdef BOOST_CHRONO_HAS_CLOCK_MONOTONIC
     boost::chrono::monotonic_timer::duration mono_dur = mono.elapsed();
+#endif
     boost::chrono::high_resolution_timer::duration hires_dur = hires.elapsed();
     boost::chrono::process_times times;
     process.elapsed( times );
@@ -126,10 +131,12 @@
     BOOST_CHECK( sys_dur > timeout_in_nanoseconds - maximum_delta
       && sys_dur < timeout_in_nanoseconds + maximum_delta );
 
+#ifdef BOOST_CHRONO_HAS_CLOCK_MONOTONIC
     std::cout << mono_dur.count() << " mono_dur\n";
 
     BOOST_CHECK( mono_dur > timeout_in_nanoseconds - maximum_delta
       && mono_dur < timeout_in_nanoseconds + maximum_delta );
+#endif
 
     std::cout << hires_dur.count() << " hires_dur\n";
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk