Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58328 - in sandbox/chrono/libs/chrono: doc doc/html doc/html/boost_chrono doc/html/boost_chrono/appendices doc/html/boost_chrono/examples doc/html/boost_chrono/overview doc/html/boost_chrono/reference doc/html/boost_chrono/users_guide example test
From: vicente.botet_at_[hidden]
Date: 2009-12-12 13:56:35


Author: viboes
Date: 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
New Revision: 58328
URL: http://svn.boost.org/trac/boost/changeset/58328

Log:
Boost.Chrono: Version 0.2.6
* Update documentation
* examples cleanup
Added:
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/cycle_count.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/how_you_override_the_duration_s_default_constructor.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/min_utility.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/runtime_resolution.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/simulated_thread_interface_demonstration_program.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/time_command.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/xtime_clock.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/xtime_conversions.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/overview/caveat_emptor.html (contents, props changed)
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference_.html (contents, props changed)
Text files modified:
   sandbox/chrono/libs/chrono/doc/chrono.qbk | 966 +++++++++++++++++++++++++++++++++++++--
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices.html | 7
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/acknowledgements.html | 3
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/appendix_e__tests.html | 4
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/history.html | 58 ++
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/implementation.html | 4
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/rationale.html | 8
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/todo.html | 4
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples.html | 4
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/a_tiny_program_that_times_how_long_until_a_key_is_struck.html | 71 ++
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/howard_hinnant_s_original_demonstration_program.html | 11
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/run_timer_example2_cpp.html | 8
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/run_timer_example_cpp.html | 13
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/saturating.html | 7
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/si_units.html | 226 +++++++++
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/overview.html | 12
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/overview/motivation.html | 40
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference.html | 4
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/chrono_hpp.html | 4
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/common_type_hpp.html | 4
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/process_times_hpp.html | 2
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/ratio_hpp.html | 2
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/timer_hpp.html | 2
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/users_guide/ext_references.html | 2
   sandbox/chrono/libs/chrono/doc/html/boost_chrono/users_guide/getting_started.html | 117 ++-
   sandbox/chrono/libs/chrono/doc/html/index.html | 10
   sandbox/chrono/libs/chrono/doc/html/standalone_HTML.manifest | 2
   sandbox/chrono/libs/chrono/example/run_timer_example2.cpp | 14
   sandbox/chrono/libs/chrono/example/simulated_thread_interface_demo.cpp | 53 -
   sandbox/chrono/libs/chrono/example/timeval_demo.cpp | 56 +-
   sandbox/chrono/libs/chrono/example/timex.cpp | 4
   sandbox/chrono/libs/chrono/example/xtime.cpp | 2
   sandbox/chrono/libs/chrono/test/Jamfile.v2 | 4
   sandbox/chrono/libs/chrono/test/ratio_test.cpp | 7
   34 files changed, 1487 insertions(+), 248 deletions(-)

Modified: sandbox/chrono/libs/chrono/doc/chrono.qbk
==============================================================================
--- sandbox/chrono/libs/chrono/doc/chrono.qbk (original)
+++ sandbox/chrono/libs/chrono/doc/chrono.qbk 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -85,12 +85,12 @@
 
 Finally, you can mentally add the following to any code fragments in this document:
 
- // Include all of Chono files
- #include <boost/chono.hpp>
+ // Include all of Chrono files
+ #include <boost/chrono.hpp>
     #include <boost/ratio.hpp>
     #include <boost/type_traits/common_type.hpp>
- #include <boost/chono/timer.hpp>
- #include <boost/chono/process_times.hpp>
+ #include <boost/chrono/timer.hpp>
+ #include <boost/chrono/process_times.hpp>
 
 [/=================]
 [section Motivation]
@@ -439,23 +439,25 @@
 
 You can also access the latest (unstable?) state from the [@https://svn.boost.org/svn/boost/sandbox/chrono Boost Sandbox].
 
+[/==========================================]
+[heading Where to install __Boost_Chrono__? ]
+[/==========================================]
+
+The simple way is to decompress (or checkout from SVN) the file in your BOOST_ROOT directory.
+
+Othesewise, if you decompress in another directory, you will need to comment some lines, and uncomment and change others in the build/Jamfile and test/Jamfile. Sorry for this, but I have not reached yet to write a Jamfile that is able to work in both environements and use the BOOST_ROOT variable. Any help is welcome.
+
 [/=================================]
 [heading Building __Boost_Chrono__ ]
 [/=================================]
 
 __Boost_Chrono__ is not a header only library. You need to compile it before use.
 
-The simple way is to decompress the compressed file in the Boost release directory you want to test.
-
     bjam libs/chrono/build
 
-If you decompress in another directory, you will need to comment some lines, and uncomment and change others. Sorry for this, but I have not rached yet to write a Jamfile that is able to work in both environements and use the BOOST_ROOT variable. Any help is welcome.
-
-
-
-[/=========================]
+[/===================]
 [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).
 
@@ -469,10 +471,13 @@
     [[@http://www.boost.org/libs/exception [*Boost.Exception]]] [for throw_exception, ...]
 ]
 [
+ [[@http://www.boost.org/libs/integer [*Boost.Integer]]] [for cstdint conformance, ...]
+]
+[
     [[@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/type_traits [*Boost.TypeTraits]]] [for is_base, ...]
 ]
 [
     [[@http://www.boost.org/libs/typeof [*Boost.Typeof]]] [for typeof, ...]
@@ -482,21 +487,27 @@
 ]
 ]
 
-[/========================]
-[heading Exceptions safety]
-[/========================]
+[/=========================================================]
+[heading Building an executable that uses __Boost_Chrono__ ]
+[/=========================================================]
+
+In addition to link with the Boost Chrono library you need also to link with the Boost System library.
+
+[/=========================]
+[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]
-[/====================]
+[/=====================]
+[heading Thread safety ]
+[/=====================]
 
 All functions in the library are thread-unsafe except when noted explicitly.
 
-[/=======================]
-[heading Tested compilers]
-[/=======================]
+[/========================]
+[heading Tested compilers ]
+[/========================]
 
 The implementation will eventually work with most C++03 conforming compilers. Initial tests have been run on
 
@@ -530,9 +541,9 @@
 [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:
 
@@ -573,7 +584,9 @@
 
 [endsect]
 
+[/================================]
 [section:ext_references References]
+[/================================]
 
 [variablelist
 
@@ -604,12 +617,14 @@
 
 [endsect]
 
-[section Reference]
+[/=================]
+[section:reference Reference ]
+[/=================]
 
 
-[/==========================================================================================]
+[/===================================================================]
 [section:common_type_hpp Header `<boost/type_traits/common_type.hpp>`]
-[/==========================================================================================]
+[/===================================================================]
 
     namespace boost {
       template <class ...T> struct common_type;
@@ -651,9 +666,9 @@
 [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).
 
@@ -852,9 +867,9 @@
 [endsect]
 
 
-[/==========================================================================================]
+[/=============================================]
 [section:chrono_hpp Header `<boost/chrono.hpp>`]
-[/==========================================================================================]
+[/=============================================]
 
     namespace boost {
     namespace chrono {
@@ -1757,9 +1772,9 @@
 
 [endsect]
 
-[/==========================================================================================]
+[/==================================================]
 [section:timer_hpp Header `<boost/chrono/timer.hpp>`]
-[/==========================================================================================]
+[/==================================================]
 
     namespace boost { namespace chrono {
 
@@ -1789,9 +1804,9 @@
 
 [endsect]
 
-[/==========================================================================================]
+[/==================================================================]
 [section:process_times_hpp Header `<boost/chrono/process_times.hpp>`]
-[/==========================================================================================]
+[/==================================================================]
 
     namespace boost { namespace chrono {
 
@@ -1874,25 +1889,301 @@
 
 [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.
 
+length - mimics std::chrono::duration except restricts representation to double.
+Uses boost::ratio facilities for length units conversions.
+
+ template <class Ratio>
+ class length {
+ private:
+ double len_;
+ public:
+ typedef Ratio ratio;
+ length() : len_(1) {}
+ length(const double& len) : len_(len) {}
+
+ template <class R>
+ length(const length<R>& d)
+ : len_(d.count() * boost::ratio_divide<Ratio, R>::type::den /
+ boost::ratio_divide<Ratio, R>::type::num) {}
+
+ double count() const {return len_;}
+
+ length& operator+=(const length& d) {len_ += d.count(); return *this;}
+ length& operator-=(const length& d) {len_ -= d.count(); return *this;}
+
+ length operator+() const {return *this;}
+ length operator-() const {return length(-len_);}
+
+ length& operator*=(double rhs) {len_ *= rhs; return *this;}
+ length& operator/=(double rhs) {len_ /= rhs; return *this;}
+ };
+
+
+Sparse sampling of length units
+
+ typedef length<boost::ratio<1> > meter; // set meter as "unity"
+ typedef length<boost::centi> centimeter; // 1/100 meter
+ typedef length<boost::kilo> kilometer; // 1000 meters
+ typedef length<boost::ratio<254, 10000> > inch; // 254/10000 meters
+
+length takes ratio instead of two integral types so that definitions can be made like so:
+
+ typedef length<boost::ratio_multiply<boost::ratio<12>, inch::ratio>::type> foot; // 12 inchs
+ typedef length<boost::ratio_multiply<boost::ratio<5280>, foot::ratio>::type> mile; // 5280 feet
+
+Need a floating point definition of seconds
+
+ typedef boost::chrono::duration<double> seconds; // unity
+
+Demo of (scientific) support for sub-nanosecond resolutions
+
+ typedef boost::chrono::duration<double, boost::pico> picosecond; // 10^-12 seconds
+ typedef boost::chrono::duration<double, boost::femto> femtosecond; // 10^-15 seconds
+ typedef boost::chrono::duration<double, boost::atto> attosecond; // 10^-18 seconds
+
+A very brief proof-of-concept for SIUnits-like library. Hard-wired to floating point seconds and meters, but accepts other units.
+
+ template <class R1, class R2>
+ class quantity
+ {
+ double q_;
+ public:
+ typedef R1 time_dim;
+ typedef R2 distance_dim;
+ quantity() : q_(1) {}
+
+ double get() const {return q_;}
+ void set(double q) {q_ = q;}
+ };
+
+ template <>
+ class quantity<boost::ratio<1>, boost::ratio<0> >
+ {
+ double q_;
+ public:
+ quantity() : q_(1) {}
+ quantity(seconds d) : q_(d.count()) {} // note: only User1::seconds needed here
+
+ double get() const {return q_;}
+ void set(double q) {q_ = q;}
+ };
+
+ template <>
+ class quantity<boost::ratio<0>, boost::ratio<1> >
+ {
+ double q_;
+ public:
+ quantity() : q_(1) {}
+ quantity(meter d) : q_(d.count()) {} // note: only User1::meter needed here
+
+ double get() const {return q_;}
+ void set(double q) {q_ = q;}
+ };
+
+ template <>
+ class quantity<boost::ratio<0>, boost::ratio<0> >
+ {
+ double q_;
+ public:
+ quantity() : q_(1) {}
+ quantity(double d) : q_(d) {}
+
+ double get() const {return q_;}
+ void set(double q) {q_ = q;}
+ };
+
+Example of SI-Units
+
+ typedef quantity<boost::ratio<0>, boost::ratio<0> > Scalar;
+ typedef quantity<boost::ratio<1>, boost::ratio<0> > Time; // second
+ typedef quantity<boost::ratio<0>, boost::ratio<1> > Distance; // meter
+ typedef quantity<boost::ratio<-1>, boost::ratio<1> > Speed; // meter/second
+ typedef quantity<boost::ratio<-2>, boost::ratio<1> > Acceleration; // meter/second^2
+
+Quantity arithmetics
+
+ 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)
+ {
+ 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;
+ }
+
+ template <class R1, class R2, class R3, class R4>
+ quantity<typename boost::ratio_add<R1, R3>::type, typename boost::ratio_add<R2, R4>::type>
+ operator*(const quantity<R1, R2>& x, const quantity<R3, R4>& y)
+ {
+ typedef quantity<typename boost::ratio_add<R1, R3>::type,
+ typename boost::ratio_add<R2, R4>::type> R;
+ R r;
+ r.set(x.get() * y.get());
+ return r;
+ }
+
+ template <class R1, class R2>
+ quantity<R1, R2>
+ operator+(const quantity<R1, R2>& x, const quantity<R1, R2>& y)
+ {
+ typedef quantity<R1, R2> R;
+ R r;
+ r.set(x.get() + y.get());
+ return r;
+ }
+
+ template <class R1, class R2>
+ quantity<R1, R2>
+ operator-(const quantity<R1, R2>& x, const quantity<R1, R2>& y)
+ {
+ typedef quantity<R1, R2> R;
+ R r;
+ r.set(x.get() - y.get());
+ return r;
+ }
+
+Example type-safe physics function
+
+ Distance
+ compute_distance(Speed v0, Time t, Acceleration a)
+ {
+ return v0 * t + Scalar(.5) * a * t * t; // if a units mistake is made here it won't compile
+ }
+
+
+Exercise example type-safe physics function and show interoperation
+of custom time durations (User1::seconds) and standard time durations (std::hours).
+Though input can be arbitrary (but type-safe) units, output is always in SI-units
+(a limitation of the simplified Units lib demoed here).
+
+ int main()
+ {
+ typedef boost::ratio<8, BOOST_INTMAX_C(0x7FFFFFFFD)> R1;
+ typedef boost::ratio<3, BOOST_INTMAX_C(0x7FFFFFFFD)> R2;
+ 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 boost::ratio_subtract<R1, R2>::type RS;
+ std::cout << RS::num << '/' << RS::den << '\n';
+
+
+ std::cout << "*************\n";
+ std::cout << "* testUser1 *\n";
+ std::cout << "*************\n";
+ User1::Distance d( User1::mile(110) );
+ User1::Time t( boost::chrono::hours(2) );
+
+ 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();
+ std::cout << "Acceleration = " << a.get() << " meters/sec^2\n";
+ User1::Distance df = compute_distance(s, User1::Time( User1::seconds(0.5) ), a);
+ std::cout << "Distance = " << df.get() << " meters\n";
+ std::cout << "There are " << User1::mile::ratio::den << '/' << User1::mile::ratio::num << " miles/meter";
+ User1::meter mt = 1;
+ User1::mile mi = mt;
+ std::cout << " which is approximately " << mi.count() << '\n';
+ std::cout << "There are " << User1::mile::ratio::num << '/' << User1::mile::ratio::den << " meters/mile";
+ mi = 1;
+ mt = mi;
+ std::cout << " which is approximately " << mt.count() << '\n';
+ User1::attosecond as(1);
+ User1::seconds sec = as;
+ std::cout << "1 attosecond is " << sec.count() << " seconds\n";
+ std::cout << "sec = as; // compiles\n";
+ sec = User1::seconds(1);
+ as = sec;
+ std::cout << "1 second is " << as.count() << " attoseconds\n";
+ std::cout << "as = sec; // compiles\n";
+ std::cout << "\n";
+ return 0;
+ }
+
 [/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)
+Next follows how you override the duration's default constructor to do anything you want (in this case zero). All we need to do is to change the representation
+
+ namespace I_dont_like_the_default_duration_behavior {
+
+ template <class R>
+ class zero_default
+ {
+ public:
+ typedef R rep;
 
-[/i_dont_like_the_default_duration_behavior_cpp]
+ 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;
+ }
+
+Usage
+
+ using namespace I_dont_like_the_default_duration_behavior;
+
+ milliseconds ms;
+ std::cout << ms.count() << '\n';
+
+['See the file i_dont_like_the_default_duration_behavior.cpp]
 
 [endsect]
 
+[/==================]
 [section min utility]
 
 Returns the earliest time_point.
@@ -1919,56 +2210,571 @@
 
 [endsect]
 
+[/==================]
 [section Cycle count]
 
-How you override the duration's default constructor to do anything you want (in this case zero)
+ #include <boost/chrono/chrono.hpp>
+ #include <boost/type_traits.hpp>
+
+ #include <iostream>
+
+ 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));
+ }
+ };
+
+
+['See the file libs/chrono/example/cycle_count.cpp]
+
+[endsect]
+
+[/==================]
+[section xtime conversions]
+
+Example round_up utility: converts d to To, rounding up for inexact conversions
+Being able to *easily* write this function is a major feature!
+
+ #include <boost/chrono/chrono.hpp>
+ #include <boost/type_traits.hpp>
+
+ #include <iostream>
+
+ using namespace boost::chrono;
+
+ 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:
+
+
+ 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";
+ }
+
+Usage
+
+ 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);
+
 
-[/cycle_count_cpp]
+[/xtime_cpp]
 
 [endsect]
 
+[/==================]
 [section xtime_clock]
 
+This example demonstrates the use of a timeval-like struct to be used as the representation
+type for both duraiton and time_point.
 
-[/xtime_clock_cpp]
+ 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 << '}';}
+ };
+
+Clock based on timeval-like struct.
+
+ 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)
+ 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
+ }
+ };
+
+Usage of xtime_clock
+
+ using namespace boost::chrono;
+ 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";
 
 [endsect]
 
+[/=========================]
 [section runtime_resolution]
 
+Handle duration with resolution not known until run time
+
+ 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);}
+ };
 
-[/runtime_resolution_cpp]
+
+['See the file libs/chrono/example/runtime_resolution.cpp]
 
 [endsect]
 
+[/=======================================================]
 [section Simulated thread interface demonstration program]
 
 [/simulated_thread_interface_demo_cpp]
 
-[endsect]
+Free sleep functions
+
+ namespace boost { 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 ";
+ detail::print_time(st);
+ std::cout << " which is " << (st - system_clock::now()).count() << " microseconds away\n";
+ }
+ }
+
+ }}
+
+
+timed_mutex modified fuctions
+
+ namespace boost {
+ struct timed_mutex {
+ // ...
+
+ 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 ";
+ detail::print_time(st);
+ std::cout << " which is " << (st - system_clock::now()).count()
+ << " microseconds away\n";
+ return true;
+ }
+ };
+ }
+
+condition_variable modified fuctions
+
+ namespace boost {
+ 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 ";
+ detail::print_time(st);
+ std::cout << " which is " << (st - system_clock::now()).count()
+ << " microseconds away\n";
+ return true;
+ }
+ };
+ }
+
+Usage
 
+ boost::mutex m;
+ boost::timed_mutex mut;
+ boost::condition_variable cv;
 
+ using namespace boost;
+ using namespace boost::chrono;
+
+ this_thread::sleep_for(seconds(3));
+ this_thread::sleep_for(nanoseconds(300));
+ system_clock::time_point time_limit = system_clock::now() + seconds(4) + milliseconds(500);
+ this_thread::sleep_until(time_limit);
+
+ mut.try_lock_for(milliseconds(30));
+ mut.try_lock_until(time_limit);
 
-[section saturating]
+ 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));
+
+
+[/See the file libs/chrono/example/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]
+['See the file libs/chrono/example/satutating.cpp]
 
 [endsect]
 
+[/======================================================]
 [section Howard Hinnant's original demonstration program]
 
-[/time2_demo_cpp]
+['See the file libs/chrono/example/time2_demo.cpp]
 
 [endsect]
 
+[/===============================================================]
 [section A tiny program that times how long until a key is struck]
 
 [/await_keystroke_cpp]
 
+ #include <boost/chrono/chrono.hpp>
+ #include <iostream>
+ #include <iomanip>
+
+ using namespace boost::chrono;
+
+ template< class Clock >
+ class timer
+ {
+ typename Clock::time_point start;
+ public:
+
+ timer() : start( Clock::now() ) {}
+
+ typename Clock::duration elapsed() const
+ {
+ return Clock::now() - start;
+ }
+
+ double seconds() const
+ {
+ return elapsed().count() * ((double)Clock::period::num/Clock::period::den);
+ }
+ };
+
+ int main()
+ {
+ timer<system_clock> t1;
+ timer<monotonic_clock> t2;
+ timer<high_resolution_clock> t3;
+
+ std::cout << "Strike any key: ";
+ std::cin.get();
+
+ std::cout << std::fixed << std::setprecision(9);
+ std::cout << "system_clock-----------: "
+ << t1.seconds() << " seconds\n";
+ std::cout << "monotonic_clock--------: "
+ << t2.seconds() << " seconds\n";
+ std::cout << "high_resolution_clock--: "
+ << t3.seconds() << " seconds\n";
+
+ system_clock::time_point d4 = system_clock::now();
+ system_clock::time_point d5 = system_clock::now();
+
+ std::cout << "\nsystem_clock latency-----------: " << (d5 - d4).count() << std::endl;
+
+ monotonic_clock::time_point d6 = monotonic_clock::now();
+ monotonic_clock::time_point d7 = monotonic_clock::now();
+
+ std::cout << "monotonic_clock latency--------: " << (d7 - d6).count() << std::endl;
+
+ high_resolution_clock::time_point d8 = high_resolution_clock::now();
+ high_resolution_clock::time_point d9 = high_resolution_clock::now();
+
+ std::cout << "high_resolution_clock latency--: " << (d9 - d8).count() << std::endl;
+
+ std::time_t now = system_clock::to_time_t(system_clock::now());
+
+ std::cout << "\nsystem_clock::now() reports UTC is "
+ << std::asctime(std::gmtime(&now)) << "\n";
+
+ return 0;
+ }
+
 [endsect]
 
+[/============================]
 [section run_timer_example.cpp]
 
 Here is the run_timer_example.cpp program supplied with the Boost Chrono library:
@@ -1977,6 +2783,19 @@
 
 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.
 
+ #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;
+ }
+
 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%)
@@ -1985,6 +2804,8 @@
 
 [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:
@@ -1997,7 +2818,7 @@
       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 );
+ boost::chrono::run_timer t( format, places );
 
       for ( long i = 0; i < 10000000; ++i )
         std::sqrt( 123.456L ); // burn some time
@@ -2021,6 +2842,49 @@
 
 [endsect]
 
+[/===============================================================]
+[section time command]
+
+ #include <boost/chrono/timer.hpp>
+ #include <cstdlib>
+ #include <string>
+ #include <iostream>
+
+ int main( int argc, char * argv[] )
+ {
+ if ( argc == 1 )
+ {
+ std::cout << "invoke: timex [-v] command [args...]\n"
+ " command will be executed and timings displayed\n"
+ " -v option causes command and args to be displayed\n";
+ return 1;
+ }
+
+ std::string s;
+
+ bool verbose = false;
+ if ( argc > 1 && *argv[1] == '-' && *(argv[1]+1) == 'v' )
+ {
+ verbose = true;
+ ++argv;
+ --argc;
+ }
+
+ for ( int i = 1; i < argc; ++i )
+ {
+ if ( i > 1 ) s += ' ';
+ s += argv[i];
+ }
+
+ if ( verbose )
+ { std::cout << "command: \"" << s.c_str() << "\"\n"; }
+
+ boost::chrono::run_timer t;
+
+ return std::system( s.c_str() );
+ }
+
+[endsect]
 
 [endsect]
 [/=================]
@@ -2038,7 +2902,7 @@
 * Define BOOST_CHRONO_HAS_CLOCK_MONOTONIC when BOOST_CHRONO_WINDOWS_API
 * Commenting invalid operator declarations
 * Take care of Boost min/max recommendations
-* complete qualification boost::chrono::duration to avoid possible BUG in gcc-4.4.0 reporting the following error
+* complete qualification when defining nested typedef duration on clocks to avoid the following compile error:
 
     ./boost/chrono/chrono.hpp:945: error: declaration of 'typedef class boost::chrono::duration<long long int, boost::ratio<1ll, 10000000ll> > boost::chrono::system_clock::duration'
     ./boost/chrono/chrono.hpp:458: error: changes meaning of 'duration' from 'class boost::chrono::duration<long long int, boost::ratio<1ll, 10000000ll> >'
@@ -2070,7 +2934,7 @@
 * Use INTMAC_C to name intmax_t constants instead of LL.
 * 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
+* 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.
 
@@ -2114,6 +2978,7 @@
 [endsect]
 [endsect]
 
+[/======================================]
 [section:rationale Appendix B: Rationale]
 
 See [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2661.htm [*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.
@@ -2181,6 +3046,7 @@
 
 [endsect]
 
+[/======================================================]
 [section:implementation Appendix C: Implementation Notes]
 
 
@@ -2194,6 +3060,7 @@
 
 [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.
@@ -2202,6 +3069,7 @@
 
 Much thanks to Andrei Alexandrescu, Walter Brown, Peter Dimov, Jeff Garland, Terry Golubiewski, Daniel Krugler, Anthony Williams.
 
+Thanks to Tom Tam to report some compiler issues with MSVC and MinGW-gcc-4.4.0.
 
 [endsect]
 [section Appendix E: Tests]

Modified: sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -6,7 +6,7 @@
 <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="prev" href="examples/time_command.html" title="time command">
 <link rel="next" href="appendices/history.html" title=" Appendix A: History">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
@@ -20,7 +20,7 @@
 </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>
+<a accesskey="p" href="examples/time_command.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">
@@ -29,6 +29,7 @@
 <div class="toc"><dl>
 <dt><span class="section"> Appendix A: History</span></dt>
 <dd><dl>
+<dt><span class="section">Version 0.2.1, December 12, 2009 Bug fixes</span></dt>
 <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
@@ -61,7 +62,7 @@
 </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>
+<a accesskey="p" href="examples/time_command.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>

Modified: sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/acknowledgements.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/acknowledgements.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/acknowledgements.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -43,6 +43,9 @@
         Much thanks to Andrei Alexandrescu, Walter Brown, Peter Dimov, Jeff Garland,
         Terry Golubiewski, Daniel Krugler, Anthony Williams.
       </p>
+<p>
+ Thanks to Tom Tam to report some compiler issues with MSVC and MinGW-gcc-4.4.0.
+ </p>
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 <td align="left"></td>

Modified: sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/appendix_e__tests.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/appendix_e__tests.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/appendix_e__tests.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -37,7 +37,7 @@
 <dt><span class="section">timer</span></dt>
 </dl></div>
 <p>
- In order to test you need to do just
+ In order to test you need to do.
       </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>
@@ -84,7 +84,7 @@
 <tr>
 <td>
                 <p>
- ratio_fail_1.
+ ratio_fail_1
                 </p>
                 </td>
 <td>

Modified: sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/history.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/history.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/history.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -27,6 +27,7 @@
 <a name="boost_chrono.appendices.history"></a> Appendix A: History
 </h3></div></div></div>
 <div class="toc"><dl>
+<dt><span class="section">Version 0.2.1, December 12, 2009 Bug fixes</span></dt>
 <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
@@ -34,6 +35,57 @@
 </dl></div>
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h4 class="title">
+<a name="boost_chrono.appendices.history.__version_0_2_1__december_12__2009____bug_fixes_"></a>Version 0.2.1, December 12, 2009 Bug fixes
+</h4></div></div></div>
+<p>
+ <span class="bold"><strong>Bug Fixes</strong></span>
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ Replace INTMAX_C by BOOST_INTMAX_C until boost/cstdint;hpp ensures INTMAX_C
+ is always defined.
+ </li>
+<li>
+ Define BOOST_CHRONO_HAS_CLOCK_MONOTONIC when BOOST_CHRONO_WINDOWS_API
+ </li>
+<li>
+ Commenting invalid operator declarations
+ </li>
+<li>
+ Take care of Boost min/max recommendations
+ </li>
+<li>
+ complete qualification when defining nested typedef duration on clocks
+ to avoid the following compile error:
+ </li>
+</ul></div>
+<pre class="programlisting"><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">chrono</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">:</span><span class="number">945</span><span class="special">:</span> <span class="identifier">error</span><span class="special">:</span> <span class="identifier">declaration</span> <span class="identifier">of</span> <span class="char">'typedef class boost::chrono::duration&lt;long long int, boost::ratio&lt;1ll, 10000000ll&gt; &gt; boost::chrono::system_clock::duration'</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">chrono</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">:</span><span class="number">458</span><span class="special">:</span> <span class="identifier">error</span><span class="special">:</span> <span class="identifier">changes</span> <span class="identifier">meaning</span> <span class="identifier">of</span> <span class="char">'duration'</span> <span class="identifier">from</span> <span class="char">'class boost::chrono::duration&lt;long long int, boost::ratio&lt;1ll, 10000000ll&gt; &gt;'</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ cleanup of simulated...
+ </li>
+<li>
+ warning removal on posix/process_clock.cpp
+ </li>
+<li>
+ disable VC++ foolishness
+ </li>
+<li>
+ Update Jamfiles to manage with dll
+ </li>
+<li>
+ removal of conversion warning in test_duration
+ </li>
+<li>
+ manage with MSVC reporting a warning instead of an error when there is
+ an integral constant overflow
+ </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_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>
@@ -55,7 +107,7 @@
             is provided on this platform.
           </li>
 <li>
- Added duration operator% (934. duration is missing operator%)
+ Added duration operator% (LGW 934. duration is missing operator%)
           </li>
 <li>
             Added BOOST_CONSTEXPR when constexpr should be used
@@ -81,7 +133,7 @@
             platforms.
           </li>
 <li>
- Added the error_code prototype for monotonic_clock::now for mac/chono.cpp
+ Added the error_code prototype for monotonic_clock::now for mac/chrono.cpp
           </li>
 <li>
             Fully implement mac/chrono.cpp with error handling.
@@ -97,7 +149,7 @@
             The documentation is written now using quick-book using as base N2661 - A Foundation to Sleep On .
           </li></ul></div>
 <p>
- <span class="bold"><strong>Bugs</strong></span>
+ <span class="bold"><strong>Bug Fixes</strong></span>
         </p>
 <div class="itemizedlist"><ul type="disc">
 <li>

Modified: sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/implementation.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/implementation.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/implementation.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -31,7 +31,7 @@
       Implementation Notes</a>
 </h3></div></div></div>
 <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="id4854709"></a>
+<a name="id4880856"></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>
@@ -42,7 +42,7 @@
         dangerously.
       </p>
 <a name="boost_chrono.appendices.implementation.why_does_run_timer_sometimes_report_more_cpu_seconds_than_real_seconds_"></a><h4>
-<a name="id4854749"></a>
+<a name="id4880896"></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>

Modified: sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/rationale.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/rationale.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/rationale.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -33,7 +33,7 @@
         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="id4853554"></a>
+<a name="id4879701"></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>
@@ -45,7 +45,7 @@
 <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>
 <a name="boost_chrono.appendices.rationale.why_duration_needs_operator_"></a><h4>
-<a name="id4853644"></a>
+<a name="id4879791"></a>
         <a href="rationale.html#boost_chrono.appendices.rationale.why_duration_needs_operator_">Why
         duration needs operator%</a>
       </h4>
@@ -73,7 +73,7 @@
 <span class="special">};</span>
 </pre>
 <a name="boost_chrono.appendices.rationale.why_ratio_needs_copyconstruction_and_assignment_from_ratios_having_the_same_normalized_form"></a><h4>
-<a name="id4854223"></a>
+<a name="id4880370"></a>
         <a href="rationale.html#boost_chrono.appendices.rationale.why_ratio_needs_copyconstruction_and_assignment_from_ratios_having_the_same_normalized_form">Why
         ratio needs CopyConstruction and Assignment from ratios having the same normalized
         form</a>
@@ -102,7 +102,7 @@
         succeeds.
       </p>
 <a name="boost_chrono.appendices.rationale.why_ratio_needs_the_nested_normalizer_typedef_type"></a><h4>
-<a name="id4854512"></a>
+<a name="id4880659"></a>
         <a href="rationale.html#boost_chrono.appendices.rationale.why_ratio_needs_the_nested_normalizer_typedef_type">Why
         ratio needs the nested normalizer typedef type</a>
       </h4>

Modified: sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/todo.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/todo.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/appendices/todo.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -27,7 +27,7 @@
 <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="id4855339"></a>
+<a name="id4881491"></a>
         <a href="todo.html#boost_chrono.appendices.todo.tasks_to_do_before_review">Tasks
         to do before review</a>
       </h4>
@@ -61,7 +61,7 @@
     &gt; high resolution timers to avoid these issues.
       </p>
 <a name="boost_chrono.appendices.todo.for_later_releases"></a><h4>
-<a name="id4855398"></a>
+<a name="id4881550"></a>
         <a href="todo.html#boost_chrono.appendices.todo.for_later_releases">For later
         releases</a>
       </h4>

Modified: sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -32,17 +32,19 @@
       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 conversions</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">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>
+<dt><span class="section">time command</span></dt>
 </dl></div>
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>

Modified: sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/a_tiny_program_that_times_how_long_until_a_key_is_struck.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/a_tiny_program_that_times_how_long_until_a_key_is_struck.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/a_tiny_program_that_times_how_long_until_a_key_is_struck.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -24,11 +24,78 @@
 <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">
+<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>
+</h3></div></div></div>
+<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">chrono</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">iostream</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iomanip</span><span class="special">&gt;</span>
+
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</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">typename</span> <span class="identifier">Clock</span><span class="special">::</span><span class="identifier">time_point</span> <span class="identifier">start</span><span class="special">;</span>
+<span class="keyword">public</span><span class="special">:</span>
+
+ <span class="identifier">timer</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">start</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="special">{}</span>
+
+ <span class="keyword">typename</span> <span class="identifier">Clock</span><span class="special">::</span><span class="identifier">duration</span> <span class="identifier">elapsed</span><span class="special">()</span> <span class="keyword">const</span>
+ <span class="special">{</span>
+ <span class="keyword">return</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">start</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="keyword">double</span> <span class="identifier">seconds</span><span class="special">()</span> <span class="keyword">const</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">elapsed</span><span class="special">().</span><span class="identifier">count</span><span class="special">()</span> <span class="special">*</span> <span class="special">((</span><span class="keyword">double</span><span class="special">)</span><span class="identifier">Clock</span><span class="special">::</span><span class="identifier">period</span><span class="special">::</span><span class="identifier">num</span><span class="special">/</span><span class="identifier">Clock</span><span class="special">::</span><span class="identifier">period</span><span class="special">::</span><span class="identifier">den</span><span class="special">);</span>
+ <span class="special">}</span>
+<span class="special">};</span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="identifier">timer</span><span class="special">&lt;</span><span class="identifier">system_clock</span><span class="special">&gt;</span> <span class="identifier">t1</span><span class="special">;</span>
+ <span class="identifier">timer</span><span class="special">&lt;</span><span class="identifier">monotonic_clock</span><span class="special">&gt;</span> <span class="identifier">t2</span><span class="special">;</span>
+ <span class="identifier">timer</span><span class="special">&lt;</span><span class="identifier">high_resolution_clock</span><span class="special">&gt;</span> <span class="identifier">t3</span><span class="special">;</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Strike any key: "</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cin</span><span class="special">.</span><span class="identifier">get</span><span class="special">();</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">fixed</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="number">9</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"system_clock-----------: "</span>
+ <span class="special">&lt;&lt;</span> <span class="identifier">t1</span><span class="special">.</span><span class="identifier">seconds</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="string">" seconds\n"</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"monotonic_clock--------: "</span>
+ <span class="special">&lt;&lt;</span> <span class="identifier">t2</span><span class="special">.</span><span class="identifier">seconds</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="string">" seconds\n"</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"high_resolution_clock--: "</span>
+ <span class="special">&lt;&lt;</span> <span class="identifier">t3</span><span class="special">.</span><span class="identifier">seconds</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="string">" seconds\n"</span><span class="special">;</span>
+
+ <span class="identifier">system_clock</span><span class="special">::</span><span class="identifier">time_point</span> <span class="identifier">d4</span> <span class="special">=</span> <span class="identifier">system_clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">();</span>
+ <span class="identifier">system_clock</span><span class="special">::</span><span class="identifier">time_point</span> <span class="identifier">d5</span> <span class="special">=</span> <span class="identifier">system_clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">();</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"\nsystem_clock latency-----------: "</span> <span class="special">&lt;&lt;</span> <span class="special">(</span><span class="identifier">d5</span> <span class="special">-</span> <span class="identifier">d4</span><span class="special">).</span><span class="identifier">count</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="identifier">monotonic_clock</span><span class="special">::</span><span class="identifier">time_point</span> <span class="identifier">d6</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">monotonic_clock</span><span class="special">::</span><span class="identifier">time_point</span> <span class="identifier">d7</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">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"monotonic_clock latency--------: "</span> <span class="special">&lt;&lt;</span> <span class="special">(</span><span class="identifier">d7</span> <span class="special">-</span> <span class="identifier">d6</span><span class="special">).</span><span class="identifier">count</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="identifier">high_resolution_clock</span><span class="special">::</span><span class="identifier">time_point</span> <span class="identifier">d8</span> <span class="special">=</span> <span class="identifier">high_resolution_clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">();</span>
+ <span class="identifier">high_resolution_clock</span><span class="special">::</span><span class="identifier">time_point</span> <span class="identifier">d9</span> <span class="special">=</span> <span class="identifier">high_resolution_clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">();</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"high_resolution_clock latency--: "</span> <span class="special">&lt;&lt;</span> <span class="special">(</span><span class="identifier">d9</span> <span class="special">-</span> <span class="identifier">d8</span><span class="special">).</span><span class="identifier">count</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">time_t</span> <span class="identifier">now</span> <span class="special">=</span> <span class="identifier">system_clock</span><span class="special">::</span><span class="identifier">to_time_t</span><span class="special">(</span><span class="identifier">system_clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">());</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"\nsystem_clock::now() reports UTC is "</span>
+ <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">asctime</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">gmtime</span><span class="special">(&amp;</span><span class="identifier">now</span><span class="special">))</span> <span class="special">&lt;&lt;</span> <span class="string">"\n"</span><span class="special">;</span>
+
+ <span class="keyword">return</span> <span class="number">0</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>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/cycle_count.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/cycle_count.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -0,0 +1,90 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Cycle count</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="min_utility.html" title="min utility">
+<link rel="next" href="xtime_conversions.html" title="xtime conversions">
+</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="min_utility.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="xtime_conversions.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.cycle_count"></a>Cycle count
+</h3></div></div></div>
+<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">chrono</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">hpp</span><span class="special">&gt;</span>
+
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iostream</span><span class="special">&gt;</span>
+
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">chrono</span><span class="special">;</span>
+
+
+<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">long</span> <span class="keyword">long</span> <span class="identifier">speed</span><span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">cycle_count</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio_multiply</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio</span><span class="special">&lt;</span><span class="identifier">speed</span><span class="special">&gt;,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mega</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">frequency</span><span class="special">;</span> <span class="comment">// Mhz
+</span> <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio_divide</span><span class="special">&lt;</span><span class="identifier">boost</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="identifier">frequency</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">period</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">long</span> <span class="keyword">long</span> <span class="identifier">rep</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">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">boost</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">cycle_count</span><span class="special">&gt;</span> <span class="identifier">time_point</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>
+ <span class="keyword">static</span> <span class="keyword">long</span> <span class="keyword">long</span> <span class="identifier">tick</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+ <span class="comment">// return exact cycle count
+</span> <span class="keyword">return</span> <span class="identifier">time_point</span><span class="special">(</span><span class="identifier">duration</span><span class="special">(++</span><span class="identifier">tick</span><span class="special">));</span> <span class="comment">// fake access to clock cycle count
+</span> <span class="special">}</span>
+<span class="special">};</span>
+
+<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">long</span> <span class="keyword">long</span> <span class="identifier">speed</span><span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">approx_cycle_count</span>
+<span class="special">{</span>
+ <span class="keyword">static</span> <span class="keyword">const</span> <span class="keyword">long</span> <span class="keyword">long</span> <span class="identifier">frequency</span> <span class="special">=</span> <span class="identifier">speed</span> <span class="special">*</span> <span class="number">1000000</span><span class="special">;</span> <span class="comment">// MHz
+</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">static</span> <span class="keyword">const</span> <span class="keyword">long</span> <span class="keyword">long</span> <span class="identifier">nanosec_per_sec</span> <span class="special">=</span> <span class="identifier">period</span><span class="special">::</span><span class="identifier">den</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">time_point</span><span class="special">&lt;</span><span class="identifier">approx_cycle_count</span><span class="special">&gt;</span> <span class="identifier">time_point</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>
+ <span class="keyword">static</span> <span class="keyword">long</span> <span class="keyword">long</span> <span class="identifier">tick</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+ <span class="comment">// return cycle count as an approximate number of nanoseconds
+</span> <span class="comment">// compute as if nanoseconds is only duration in the std::lib
+</span> <span class="keyword">return</span> <span class="identifier">time_point</span><span class="special">(</span><span class="identifier">duration</span><span class="special">(++</span><span class="identifier">tick</span> <span class="special">*</span> <span class="identifier">nanosec_per_sec</span> <span class="special">/</span> <span class="identifier">frequency</span><span class="special">));</span>
+ <span class="special">}</span>
+<span class="special">};</span>
+</pre>
+<p>
+ <span class="emphasis"><em>See the file libs/chrono/example/cycle_count.cpp</em></span>
+ </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="min_utility.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="xtime_conversions.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/how_you_override_the_duration_s_default_constructor.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/how_you_override_the_duration_s_default_constructor.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -0,0 +1,108 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>How
+ you override the duration's default constructor</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="si_units.html" title="SI-units">
+<link rel="next" href="min_utility.html" title="min utility">
+</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="si_units.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="min_utility.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.how_you_override_the_duration_s_default_constructor"></a><a href="how_you_override_the_duration_s_default_constructor.html" title="How
+ you override the duration's default constructor">How
+ you override the duration's default constructor</a>
+</h3></div></div></div>
+<p>
+ Next follows how you override the duration's default constructor to do anything
+ you want (in this case zero). All we need to do is to change the representation
+ </p>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">I_dont_like_the_default_duration_behavior</span> <span class="special">{</span>
+
+<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">&gt;</span>
+<span class="keyword">class</span> <span class="identifier">zero_default</span>
+<span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="identifier">R</span> <span class="identifier">rep</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="keyword">public</span><span class="special">:</span>
+ <span class="identifier">zero_default</span><span class="special">(</span><span class="identifier">rep</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span> <span class="special">:</span> <span class="identifier">rep_</span><span class="special">(</span><span class="identifier">i</span><span class="special">)</span> <span class="special">{}</span>
+ <span class="keyword">operator</span> <span class="identifier">rep</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">rep_</span><span class="special">;}</span>
+
+ <span class="identifier">zero_default</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">+=(</span><span class="identifier">zero_default</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">{</span><span class="identifier">rep_</span> <span class="special">+=</span> <span class="identifier">x</span><span class="special">.</span><span class="identifier">rep_</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="identifier">zero_default</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">-=(</span><span class="identifier">zero_default</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">{</span><span class="identifier">rep_</span> <span class="special">-=</span> <span class="identifier">x</span><span class="special">.</span><span class="identifier">rep_</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="identifier">zero_default</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">*=(</span><span class="identifier">zero_default</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">{</span><span class="identifier">rep_</span> <span class="special">*=</span> <span class="identifier">x</span><span class="special">.</span><span class="identifier">rep_</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="identifier">zero_default</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">/=(</span><span class="identifier">zero_default</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">{</span><span class="identifier">rep_</span> <span class="special">/=</span> <span class="identifier">x</span><span class="special">.</span><span class="identifier">rep_</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="identifier">zero_default</span> <span class="keyword">operator</span><span class="special">+</span> <span class="special">()</span> <span class="keyword">const</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="identifier">zero_default</span> <span class="keyword">operator</span><span class="special">-</span> <span class="special">()</span> <span class="keyword">const</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">zero_default</span><span class="special">(-</span><span class="identifier">rep_</span><span class="special">);}</span>
+ <span class="identifier">zero_default</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">++()</span> <span class="special">{++</span><span class="identifier">rep_</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="identifier">zero_default</span> <span class="keyword">operator</span><span class="special">++(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">zero_default</span><span class="special">(</span><span class="identifier">rep_</span><span class="special">++);}</span>
+ <span class="identifier">zero_default</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">--()</span> <span class="special">{--</span><span class="identifier">rep_</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="identifier">zero_default</span> <span class="keyword">operator</span><span class="special">--(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">zero_default</span><span class="special">(</span><span class="identifier">rep_</span><span class="special">--);}</span>
+
+ <span class="keyword">friend</span> <span class="identifier">zero_default</span> <span class="keyword">operator</span><span class="special">+(</span><span class="identifier">zero_default</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">zero_default</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">x</span> <span class="special">+=</span> <span class="identifier">y</span><span class="special">;}</span>
+ <span class="keyword">friend</span> <span class="identifier">zero_default</span> <span class="keyword">operator</span><span class="special">-(</span><span class="identifier">zero_default</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">zero_default</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">x</span> <span class="special">-=</span> <span class="identifier">y</span><span class="special">;}</span>
+ <span class="keyword">friend</span> <span class="identifier">zero_default</span> <span class="keyword">operator</span><span class="special">*(</span><span class="identifier">zero_default</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">zero_default</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">x</span> <span class="special">*=</span> <span class="identifier">y</span><span class="special">;}</span>
+ <span class="keyword">friend</span> <span class="identifier">zero_default</span> <span class="keyword">operator</span><span class="special">/(</span><span class="identifier">zero_default</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">zero_default</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">x</span> <span class="special">/=</span> <span class="identifier">y</span><span class="special">;}</span>
+
+ <span class="keyword">friend</span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">==(</span><span class="identifier">zero_default</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">zero_default</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">x</span><span class="special">.</span><span class="identifier">rep_</span> <span class="special">==</span> <span class="identifier">y</span><span class="special">.</span><span class="identifier">rep_</span><span class="special">;}</span>
+ <span class="keyword">friend</span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">!=(</span><span class="identifier">zero_default</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">zero_default</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="special">!(</span><span class="identifier">x</span> <span class="special">==</span> <span class="identifier">y</span><span class="special">);}</span>
+ <span class="keyword">friend</span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&lt;</span> <span class="special">(</span><span class="identifier">zero_default</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">zero_default</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">x</span><span class="special">.</span><span class="identifier">rep_</span> <span class="special">&lt;</span> <span class="identifier">y</span><span class="special">.</span><span class="identifier">rep_</span><span class="special">;}</span>
+ <span class="keyword">friend</span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&lt;=(</span><span class="identifier">zero_default</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">zero_default</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="special">!(</span><span class="identifier">y</span> <span class="special">&lt;</span> <span class="identifier">x</span><span class="special">);}</span>
+ <span class="keyword">friend</span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&gt;</span> <span class="special">(</span><span class="identifier">zero_default</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">zero_default</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">y</span> <span class="special">&lt;</span> <span class="identifier">x</span><span class="special">;}</span>
+ <span class="keyword">friend</span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&gt;=(</span><span class="identifier">zero_default</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">zero_default</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="special">!(</span><span class="identifier">x</span> <span class="special">&lt;</span> <span class="identifier">y</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">duration</span><span class="special">&lt;</span><span class="identifier">zero_default</span><span class="special">&lt;</span><span class="keyword">long</span> <span class="keyword">long</span><span class="special">&gt;,</span> <span class="identifier">boost</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="keyword">typedef</span> <span class="identifier">boost</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">zero_default</span><span class="special">&lt;</span><span class="keyword">long</span> <span class="keyword">long</span><span class="special">&gt;,</span> <span class="identifier">boost</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="keyword">typedef</span> <span class="identifier">boost</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">zero_default</span><span class="special">&lt;</span><span class="keyword">long</span> <span class="keyword">long</span><span class="special">&gt;,</span> <span class="identifier">boost</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="keyword">typedef</span> <span class="identifier">boost</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">zero_default</span><span class="special">&lt;</span><span class="keyword">long</span> <span class="keyword">long</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">seconds</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">duration</span><span class="special">&lt;</span><span class="identifier">zero_default</span><span class="special">&lt;</span><span class="keyword">long</span> <span class="keyword">long</span><span class="special">&gt;,</span> <span class="identifier">boost</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="keyword">typedef</span> <span class="identifier">boost</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">zero_default</span><span class="special">&lt;</span><span class="keyword">long</span> <span class="keyword">long</span><span class="special">&gt;,</span> <span class="identifier">boost</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="special">}</span>
+</pre>
+<p>
+ Usage
+ </p>
+<pre class="programlisting"><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">I_dont_like_the_default_duration_behavior</span><span class="special">;</span>
+
+<span class="identifier">milliseconds</span> <span class="identifier">ms</span><span class="special">;</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">ms</span><span class="special">.</span><span class="identifier">count</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="char">'\n'</span><span class="special">;</span>
+</pre>
+<p>
+ <span class="emphasis"><em>See the file i_dont_like_the_default_duration_behavior.cpp</em></span>
+ </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="si_units.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="min_utility.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Modified: sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/howard_hinnant_s_original_demonstration_program.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/howard_hinnant_s_original_demonstration_program.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/howard_hinnant_s_original_demonstration_program.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -7,7 +7,7 @@
 <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="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>
@@ -24,11 +24,16 @@
 <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">
+<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>
+</h3></div></div></div>
+<p>
+ <span class="emphasis"><em>See the file libs/chrono/example/time2_demo.cpp</em></span>
+ </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>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/min_utility.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/min_utility.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -0,0 +1,68 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>min utility</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="how_you_override_the_duration_s_default_constructor.html" title="How
+ you override the duration's default constructor">
+<link rel="next" href="cycle_count.html" title="Cycle count">
+</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="how_you_override_the_duration_s_default_constructor.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="cycle_count.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.min_utility"></a>min utility
+</h3></div></div></div>
+<p>
+ Returns the earliest time_point.
+ </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">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">common_type</span><span class="special">&lt;</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">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="identifier">type</span>
+<span class="identifier">min</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">t1</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="identifier">t2</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">t2</span> <span class="special">&lt;</span> <span class="identifier">t1</span> <span class="special">?</span> <span class="identifier">t2</span> <span class="special">:</span> <span class="identifier">t1</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ Being able to <span class="bold"><strong>easily</strong></span> write this function
+ is a major feature!
+ </p>
+<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">system_clock</span><span class="special">,</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">common_type</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">seconds</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&gt;</span> <span class="identifier">T1</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">time_point</span><span class="special">&lt;</span><span class="identifier">system_clock</span><span class="special">,</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">common_type</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">nanoseconds</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&gt;</span> <span class="identifier">T2</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">common_type</span><span class="special">&lt;</span><span class="identifier">T1</span><span class="special">,</span> <span class="identifier">T2</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">T3</span><span class="special">;</span>
+<span class="comment">/*auto*/</span> <span class="identifier">T1</span> <span class="identifier">t1</span> <span class="special">=</span> <span class="identifier">system_clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">seconds</span><span class="special">(</span><span class="number">3</span><span class="special">);</span>
+<span class="comment">/*auto*/</span> <span class="identifier">T2</span> <span class="identifier">t2</span> <span class="special">=</span> <span class="identifier">system_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">3</span><span class="special">);</span>
+<span class="comment">/*auto*/</span> <span class="identifier">T3</span> <span class="identifier">t3</span> <span class="special">=</span> <span class="identifier">min</span><span class="special">(</span><span class="identifier">t1</span><span class="special">,</span> <span class="identifier">t2</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="how_you_override_the_duration_s_default_constructor.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="cycle_count.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Modified: sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/run_timer_example2_cpp.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/run_timer_example2_cpp.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/run_timer_example2_cpp.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -7,7 +7,7 @@
 <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">
+<link rel="next" href="time_command.html" title="time command">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
 <table cellpadding="2" width="100%"><tr>
@@ -20,7 +20,7 @@
 </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>
+<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="time_command.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">
@@ -38,7 +38,7 @@
   <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="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="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
@@ -72,7 +72,7 @@
 </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>
+<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="time_command.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
 </div>
 </body>
 </html>

Modified: sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/run_timer_example_cpp.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/run_timer_example_cpp.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/run_timer_example_cpp.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -36,6 +36,19 @@
         at the end of the program, its destructor stops the timer and displays timing
         information on cout.
       </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>
         The output of this program run on a circa 2006 processor looks was this:
       </p>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/runtime_resolution.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/runtime_resolution.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -0,0 +1,104 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>runtime_resolution</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="xtime_clock.html" title="xtime_clock">
+<link rel="next" href="simulated_thread_interface_demonstration_program.html" title="Simulated
+ thread interface 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="xtime_clock.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="simulated_thread_interface_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.runtime_resolution"></a>runtime_resolution
+</h3></div></div></div>
+<p>
+ Handle duration with resolution not known until run time
+ </p>
+<pre class="programlisting"><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="keyword">long</span> <span class="keyword">long</span> <span class="identifier">rep</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="keyword">static</span> <span class="keyword">const</span> <span class="keyword">double</span> <span class="identifier">ticks_per_nanosecond</span><span class="special">;</span>
+
+<span class="keyword">public</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">duration</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">nano</span><span class="special">&gt;</span> <span class="identifier">tonanosec</span><span class="special">;</span>
+
+ <span class="identifier">duration</span><span class="special">()</span> <span class="special">{}</span> <span class="comment">// = default;
+</span> <span class="keyword">explicit</span> <span class="identifier">duration</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">rep</span><span class="special">&amp;</span> <span class="identifier">r</span><span class="special">)</span> <span class="special">:</span> <span class="identifier">rep_</span><span class="special">(</span><span class="identifier">r</span><span class="special">)</span> <span class="special">{}</span>
+
+ <span class="comment">// conversions
+</span> <span class="keyword">explicit</span> <span class="identifier">duration</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">tonanosec</span><span class="special">&amp;</span> <span class="identifier">d</span><span class="special">)</span>
+ <span class="special">:</span> <span class="identifier">rep_</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">d</span><span class="special">.</span><span class="identifier">count</span><span class="special">()</span> <span class="special">*</span> <span class="identifier">ticks_per_nanosecond</span><span class="special">))</span> <span class="special">{}</span>
+
+ <span class="comment">// explicit
+</span> <span class="keyword">operator</span> <span class="identifier">tonanosec</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">tonanosec</span><span class="special">(</span><span class="identifier">rep_</span><span class="special">/</span><span class="identifier">ticks_per_nanosecond</span><span class="special">);}</span>
+
+ <span class="comment">// observer
+</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="keyword">return</span> <span class="identifier">rep_</span><span class="special">;}</span>
+
+ <span class="comment">// arithmetic
+</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="special">{</span><span class="identifier">rep_</span> <span class="special">+=</span> <span class="identifier">d</span><span class="special">.</span><span class="identifier">rep_</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="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="special">{</span><span class="identifier">rep_</span> <span class="special">+=</span> <span class="identifier">d</span><span class="special">.</span><span class="identifier">rep_</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="identifier">duration</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">*=(</span><span class="identifier">rep</span> <span class="identifier">rhs</span><span class="special">)</span> <span class="special">{</span><span class="identifier">rep_</span> <span class="special">*=</span> <span class="identifier">rhs</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="identifier">duration</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">/=(</span><span class="identifier">rep</span> <span class="identifier">rhs</span><span class="special">)</span> <span class="special">{</span><span class="identifier">rep_</span> <span class="special">/=</span> <span class="identifier">rhs</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="identifier">duration</span> <span class="keyword">operator</span><span class="special">+()</span> <span class="keyword">const</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="identifier">duration</span> <span class="keyword">operator</span><span class="special">-()</span> <span class="keyword">const</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">duration</span><span class="special">(-</span><span class="identifier">rep_</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="special">{++</span><span class="identifier">rep_</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="identifier">duration</span> <span class="keyword">operator</span><span class="special">++(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">duration</span><span class="special">(</span><span class="identifier">rep_</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="special">{--</span><span class="identifier">rep_</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="identifier">duration</span> <span class="keyword">operator</span><span class="special">--(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">duration</span><span class="special">(</span><span class="identifier">rep_</span><span class="special">--);}</span>
+
+ <span class="keyword">friend</span> <span class="identifier">duration</span> <span class="keyword">operator</span><span class="special">+(</span><span class="identifier">duration</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">duration</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">x</span> <span class="special">+=</span> <span class="identifier">y</span><span class="special">;}</span>
+ <span class="keyword">friend</span> <span class="identifier">duration</span> <span class="keyword">operator</span><span class="special">-(</span><span class="identifier">duration</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">duration</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">x</span> <span class="special">-=</span> <span class="identifier">y</span><span class="special">;}</span>
+ <span class="keyword">friend</span> <span class="identifier">duration</span> <span class="keyword">operator</span><span class="special">*(</span><span class="identifier">duration</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">rep</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">x</span> <span class="special">*=</span> <span class="identifier">y</span><span class="special">;}</span>
+ <span class="keyword">friend</span> <span class="identifier">duration</span> <span class="keyword">operator</span><span class="special">*(</span><span class="identifier">rep</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">duration</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">y</span> <span class="special">*=</span> <span class="identifier">x</span><span class="special">;}</span>
+ <span class="keyword">friend</span> <span class="identifier">duration</span> <span class="keyword">operator</span><span class="special">/(</span><span class="identifier">duration</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">rep</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">x</span> <span class="special">/=</span> <span class="identifier">y</span><span class="special">;}</span>
+
+ <span class="keyword">friend</span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">==(</span><span class="identifier">duration</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">duration</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">x</span><span class="special">.</span><span class="identifier">rep_</span> <span class="special">==</span> <span class="identifier">y</span><span class="special">.</span><span class="identifier">rep_</span><span class="special">;}</span>
+ <span class="keyword">friend</span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">!=(</span><span class="identifier">duration</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">duration</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="special">!(</span><span class="identifier">x</span> <span class="special">==</span> <span class="identifier">y</span><span class="special">);}</span>
+ <span class="keyword">friend</span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&lt;</span> <span class="special">(</span><span class="identifier">duration</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">duration</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">x</span><span class="special">.</span><span class="identifier">rep_</span> <span class="special">&lt;</span> <span class="identifier">y</span><span class="special">.</span><span class="identifier">rep_</span><span class="special">;}</span>
+ <span class="keyword">friend</span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&lt;=(</span><span class="identifier">duration</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">duration</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="special">!(</span><span class="identifier">y</span> <span class="special">&lt;</span> <span class="identifier">x</span><span class="special">);}</span>
+ <span class="keyword">friend</span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&gt;</span> <span class="special">(</span><span class="identifier">duration</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">duration</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">y</span> <span class="special">&lt;</span> <span class="identifier">x</span><span class="special">;}</span>
+ <span class="keyword">friend</span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&gt;=(</span><span class="identifier">duration</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">duration</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="special">!(</span><span class="identifier">x</span> <span class="special">&lt;</span> <span class="identifier">y</span><span class="special">);}</span>
+<span class="special">};</span>
+</pre>
+<p>
+ <span class="emphasis"><em>See the file libs/chrono/example/runtime_resolution.cpp</em></span>
+ </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="xtime_clock.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="simulated_thread_interface_demonstration_program.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Modified: sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/saturating.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/saturating.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/saturating.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>saturating</title>
+<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">
@@ -26,7 +26,7 @@
 </div>
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h3 class="title">
-<a name="boost_chrono.examples.saturating"></a>saturating
+<a name="boost_chrono.examples.saturating"></a>Saturating
 </h3></div></div></div>
 <p>
         A "saturating" signed integral type is developed. This type has
@@ -34,6 +34,9 @@
         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>
+<p>
+ <span class="emphasis"><em>See the file libs/chrono/example/satutating.cpp</em></span>
+ </p>
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 <td align="left"></td>

Modified: sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/si_units.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/si_units.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/si_units.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -31,6 +31,232 @@
         Type-safe "physics" code interoperating with std::chrono::duration
         types and taking advantage of the std::ratio infrastructure and design philosophy.
       </p>
+<p>
+ length - mimics std::chrono::duration except restricts representation to
+ double. Uses boost::ratio facilities for length units conversions.
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Ratio</span><span class="special">&gt;</span>
+<span class="keyword">class</span> <span class="identifier">length</span> <span class="special">{</span>
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="keyword">double</span> <span class="identifier">len_</span><span class="special">;</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="identifier">Ratio</span> <span class="identifier">ratio</span><span class="special">;</span>
+ <span class="identifier">length</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">len_</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">{}</span>
+ <span class="identifier">length</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">double</span><span class="special">&amp;</span> <span class="identifier">len</span><span class="special">)</span> <span class="special">:</span> <span class="identifier">len_</span><span class="special">(</span><span class="identifier">len</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">R</span><span class="special">&gt;</span>
+ <span class="identifier">length</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">length</span><span class="special">&lt;</span><span class="identifier">R</span><span class="special">&gt;&amp;</span> <span class="identifier">d</span><span class="special">)</span>
+ <span class="special">:</span> <span class="identifier">len_</span><span class="special">(</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="identifier">boost</span><span class="special">::</span><span class="identifier">ratio_divide</span><span class="special">&lt;</span><span class="identifier">Ratio</span><span class="special">,</span> <span class="identifier">R</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="identifier">boost</span><span class="special">::</span><span class="identifier">ratio_divide</span><span class="special">&lt;</span><span class="identifier">Ratio</span><span class="special">,</span> <span class="identifier">R</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">num</span><span class="special">)</span> <span class="special">{}</span>
+
+ <span class="keyword">double</span> <span class="identifier">count</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">len_</span><span class="special">;}</span>
+
+ <span class="identifier">length</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">+=(</span><span class="keyword">const</span> <span class="identifier">length</span><span class="special">&amp;</span> <span class="identifier">d</span><span class="special">)</span> <span class="special">{</span><span class="identifier">len_</span> <span class="special">+=</span> <span class="identifier">d</span><span class="special">.</span><span class="identifier">count</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="identifier">length</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">-=(</span><span class="keyword">const</span> <span class="identifier">length</span><span class="special">&amp;</span> <span class="identifier">d</span><span class="special">)</span> <span class="special">{</span><span class="identifier">len_</span> <span class="special">-=</span> <span class="identifier">d</span><span class="special">.</span><span class="identifier">count</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="identifier">length</span> <span class="keyword">operator</span><span class="special">+()</span> <span class="keyword">const</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="identifier">length</span> <span class="keyword">operator</span><span class="special">-()</span> <span class="keyword">const</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">length</span><span class="special">(-</span><span class="identifier">len_</span><span class="special">);}</span>
+
+ <span class="identifier">length</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">*=(</span><span class="keyword">double</span> <span class="identifier">rhs</span><span class="special">)</span> <span class="special">{</span><span class="identifier">len_</span> <span class="special">*=</span> <span class="identifier">rhs</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="identifier">length</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">/=(</span><span class="keyword">double</span> <span class="identifier">rhs</span><span class="special">)</span> <span class="special">{</span><span class="identifier">len_</span> <span class="special">/=</span> <span class="identifier">rhs</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>
+ Sparse sampling of length units
+ </p>
+<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">length</span><span class="special">&lt;</span><span class="identifier">boost</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="identifier">meter</span><span class="special">;</span> <span class="comment">// set meter as "unity"
+</span><span class="keyword">typedef</span> <span class="identifier">length</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">centi</span><span class="special">&gt;</span> <span class="identifier">centimeter</span><span class="special">;</span> <span class="comment">// 1/100 meter
+</span><span class="keyword">typedef</span> <span class="identifier">length</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">kilo</span><span class="special">&gt;</span> <span class="identifier">kilometer</span><span class="special">;</span> <span class="comment">// 1000 meters
+</span><span class="keyword">typedef</span> <span class="identifier">length</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">254</span><span class="special">,</span> <span class="number">10000</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">inch</span><span class="special">;</span> <span class="comment">// 254/10000 meters
+</span></pre>
+<p>
+ length takes ratio instead of two integral types so that definitions can
+ be made like so:
+ </p>
+<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">length</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio_multiply</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">12</span><span class="special">&gt;,</span> <span class="identifier">inch</span><span class="special">::</span><span class="identifier">ratio</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&gt;</span> <span class="identifier">foot</span><span class="special">;</span> <span class="comment">// 12 inchs
+</span><span class="keyword">typedef</span> <span class="identifier">length</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio_multiply</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">5280</span><span class="special">&gt;,</span> <span class="identifier">foot</span><span class="special">::</span><span class="identifier">ratio</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&gt;</span> <span class="identifier">mile</span><span class="special">;</span> <span class="comment">// 5280 feet
+</span></pre>
+<p>
+ Need a floating point definition of seconds
+ </p>
+<pre class="programlisting"><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">duration</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span> <span class="identifier">seconds</span><span class="special">;</span> <span class="comment">// unity
+</span></pre>
+<p>
+ Demo of (scientific) support for sub-nanosecond resolutions
+ </p>
+<pre class="programlisting"><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">duration</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">pico</span><span class="special">&gt;</span> <span class="identifier">picosecond</span><span class="special">;</span> <span class="comment">// 10^-12 seconds
+</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">duration</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">femto</span><span class="special">&gt;</span> <span class="identifier">femtosecond</span><span class="special">;</span> <span class="comment">// 10^-15 seconds
+</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">duration</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">atto</span><span class="special">&gt;</span> <span class="identifier">attosecond</span><span class="special">;</span> <span class="comment">// 10^-18 seconds
+</span></pre>
+<p>
+ A very brief proof-of-concept for SIUnits-like library. Hard-wired to floating
+ point seconds and meters, but accepts other units.
+ </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">class</span> <span class="identifier">quantity</span>
+<span class="special">{</span>
+ <span class="keyword">double</span> <span class="identifier">q_</span><span class="special">;</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="identifier">R1</span> <span class="identifier">time_dim</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">R2</span> <span class="identifier">distance_dim</span><span class="special">;</span>
+ <span class="identifier">quantity</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">q_</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">{}</span>
+
+ <span class="keyword">double</span> <span class="identifier">get</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">q_</span><span class="special">;}</span>
+ <span class="keyword">void</span> <span class="identifier">set</span><span class="special">(</span><span class="keyword">double</span> <span class="identifier">q</span><span class="special">)</span> <span class="special">{</span><span class="identifier">q_</span> <span class="special">=</span> <span class="identifier">q</span><span class="special">;}</span>
+<span class="special">};</span>
+
+<span class="keyword">template</span> <span class="special">&lt;&gt;</span>
+<span class="keyword">class</span> <span class="identifier">quantity</span><span class="special">&lt;</span><span class="identifier">boost</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="identifier">boost</span><span class="special">::</span><span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;</span> <span class="special">&gt;</span>
+<span class="special">{</span>
+ <span class="keyword">double</span> <span class="identifier">q_</span><span class="special">;</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="identifier">quantity</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">q_</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">{}</span>
+ <span class="identifier">quantity</span><span class="special">(</span><span class="identifier">seconds</span> <span class="identifier">d</span><span class="special">)</span> <span class="special">:</span> <span class="identifier">q_</span><span class="special">(</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="comment">// note: only User1::seconds needed here
+</span>
+ <span class="keyword">double</span> <span class="identifier">get</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">q_</span><span class="special">;}</span>
+ <span class="keyword">void</span> <span class="identifier">set</span><span class="special">(</span><span class="keyword">double</span> <span class="identifier">q</span><span class="special">)</span> <span class="special">{</span><span class="identifier">q_</span> <span class="special">=</span> <span class="identifier">q</span><span class="special">;}</span>
+<span class="special">};</span>
+
+<span class="keyword">template</span> <span class="special">&lt;&gt;</span>
+<span class="keyword">class</span> <span class="identifier">quantity</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;,</span> <span class="identifier">boost</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="special">{</span>
+ <span class="keyword">double</span> <span class="identifier">q_</span><span class="special">;</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="identifier">quantity</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">q_</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">{}</span>
+ <span class="identifier">quantity</span><span class="special">(</span><span class="identifier">meter</span> <span class="identifier">d</span><span class="special">)</span> <span class="special">:</span> <span class="identifier">q_</span><span class="special">(</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="comment">// note: only User1::meter needed here
+</span>
+ <span class="keyword">double</span> <span class="identifier">get</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">q_</span><span class="special">;}</span>
+ <span class="keyword">void</span> <span class="identifier">set</span><span class="special">(</span><span class="keyword">double</span> <span class="identifier">q</span><span class="special">)</span> <span class="special">{</span><span class="identifier">q_</span> <span class="special">=</span> <span class="identifier">q</span><span class="special">;}</span>
+<span class="special">};</span>
+
+<span class="keyword">template</span> <span class="special">&lt;&gt;</span>
+<span class="keyword">class</span> <span class="identifier">quantity</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;</span> <span class="special">&gt;</span>
+<span class="special">{</span>
+ <span class="keyword">double</span> <span class="identifier">q_</span><span class="special">;</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="identifier">quantity</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">q_</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">{}</span>
+ <span class="identifier">quantity</span><span class="special">(</span><span class="keyword">double</span> <span class="identifier">d</span><span class="special">)</span> <span class="special">:</span> <span class="identifier">q_</span><span class="special">(</span><span class="identifier">d</span><span class="special">)</span> <span class="special">{}</span>
+
+ <span class="keyword">double</span> <span class="identifier">get</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">q_</span><span class="special">;}</span>
+ <span class="keyword">void</span> <span class="identifier">set</span><span class="special">(</span><span class="keyword">double</span> <span class="identifier">q</span><span class="special">)</span> <span class="special">{</span><span class="identifier">q_</span> <span class="special">=</span> <span class="identifier">q</span><span class="special">;}</span>
+<span class="special">};</span>
+</pre>
+<p>
+ Example of SI-Units
+ </p>
+<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">quantity</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">Scalar</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">quantity</span><span class="special">&lt;</span><span class="identifier">boost</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="identifier">boost</span><span class="special">::</span><span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">Time</span><span class="special">;</span> <span class="comment">// second
+</span><span class="keyword">typedef</span> <span class="identifier">quantity</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;,</span> <span class="identifier">boost</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="identifier">Distance</span><span class="special">;</span> <span class="comment">// meter
+</span><span class="keyword">typedef</span> <span class="identifier">quantity</span><span class="special">&lt;</span><span class="identifier">boost</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="identifier">boost</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="identifier">Speed</span><span class="special">;</span> <span class="comment">// meter/second
+</span><span class="keyword">typedef</span> <span class="identifier">quantity</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio</span><span class="special">&lt;-</span><span class="number">2</span><span class="special">&gt;,</span> <span class="identifier">boost</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="identifier">Acceleration</span><span class="special">;</span> <span class="comment">// meter/second^2
+</span></pre>
+<p>
+ Quantity arithmetics
+ </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">,</span> <span class="keyword">class</span> <span class="identifier">R3</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R4</span><span class="special">&gt;</span>
+<span class="identifier">quantity</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio_subtract</span><span class="special">&lt;</span><span class="identifier">R1</span><span class="special">,</span> <span class="identifier">R3</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio_subtract</span><span class="special">&lt;</span><span class="identifier">R2</span><span class="special">,</span> <span class="identifier">R4</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">quantity</span><span class="special">&lt;</span><span class="identifier">R1</span><span class="special">,</span> <span class="identifier">R2</span><span class="special">&gt;&amp;</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">quantity</span><span class="special">&lt;</span><span class="identifier">R3</span><span class="special">,</span> <span class="identifier">R4</span><span class="special">&gt;&amp;</span> <span class="identifier">y</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="identifier">quantity</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio_subtract</span><span class="special">&lt;</span><span class="identifier">R1</span><span class="special">,</span> <span class="identifier">R3</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span>
+ <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio_subtract</span><span class="special">&lt;</span><span class="identifier">R2</span><span class="special">,</span> <span class="identifier">R4</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&gt;</span> <span class="identifier">R</span><span class="special">;</span>
+ <span class="identifier">R</span> <span class="identifier">r</span><span class="special">;</span>
+ <span class="identifier">r</span><span class="special">.</span><span class="identifier">set</span><span class="special">(</span><span class="identifier">x</span><span class="special">.</span><span class="identifier">get</span><span class="special">()</span> <span class="special">/</span> <span class="identifier">y</span><span class="special">.</span><span class="identifier">get</span><span class="special">());</span>
+ <span class="keyword">return</span> <span class="identifier">r</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">R1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R3</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R4</span><span class="special">&gt;</span>
+<span class="identifier">quantity</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio_add</span><span class="special">&lt;</span><span class="identifier">R1</span><span class="special">,</span> <span class="identifier">R3</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio_add</span><span class="special">&lt;</span><span class="identifier">R2</span><span class="special">,</span> <span class="identifier">R4</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">quantity</span><span class="special">&lt;</span><span class="identifier">R1</span><span class="special">,</span> <span class="identifier">R2</span><span class="special">&gt;&amp;</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">quantity</span><span class="special">&lt;</span><span class="identifier">R3</span><span class="special">,</span> <span class="identifier">R4</span><span class="special">&gt;&amp;</span> <span class="identifier">y</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="identifier">quantity</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio_add</span><span class="special">&lt;</span><span class="identifier">R1</span><span class="special">,</span> <span class="identifier">R3</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span>
+ <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio_add</span><span class="special">&lt;</span><span class="identifier">R2</span><span class="special">,</span> <span class="identifier">R4</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&gt;</span> <span class="identifier">R</span><span class="special">;</span>
+ <span class="identifier">R</span> <span class="identifier">r</span><span class="special">;</span>
+ <span class="identifier">r</span><span class="special">.</span><span class="identifier">set</span><span class="special">(</span><span class="identifier">x</span><span class="special">.</span><span class="identifier">get</span><span class="special">()</span> <span class="special">*</span> <span class="identifier">y</span><span class="special">.</span><span class="identifier">get</span><span class="special">());</span>
+ <span class="keyword">return</span> <span class="identifier">r</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">R1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R2</span><span class="special">&gt;</span>
+<span class="identifier">quantity</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="keyword">operator</span><span class="special">+(</span><span class="keyword">const</span> <span class="identifier">quantity</span><span class="special">&lt;</span><span class="identifier">R1</span><span class="special">,</span> <span class="identifier">R2</span><span class="special">&gt;&amp;</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">quantity</span><span class="special">&lt;</span><span class="identifier">R1</span><span class="special">,</span> <span class="identifier">R2</span><span class="special">&gt;&amp;</span> <span class="identifier">y</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="identifier">quantity</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">R</span><span class="special">;</span>
+ <span class="identifier">R</span> <span class="identifier">r</span><span class="special">;</span>
+ <span class="identifier">r</span><span class="special">.</span><span class="identifier">set</span><span class="special">(</span><span class="identifier">x</span><span class="special">.</span><span class="identifier">get</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">y</span><span class="special">.</span><span class="identifier">get</span><span class="special">());</span>
+ <span class="keyword">return</span> <span class="identifier">r</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">R1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R2</span><span class="special">&gt;</span>
+<span class="identifier">quantity</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="keyword">operator</span><span class="special">-(</span><span class="keyword">const</span> <span class="identifier">quantity</span><span class="special">&lt;</span><span class="identifier">R1</span><span class="special">,</span> <span class="identifier">R2</span><span class="special">&gt;&amp;</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">quantity</span><span class="special">&lt;</span><span class="identifier">R1</span><span class="special">,</span> <span class="identifier">R2</span><span class="special">&gt;&amp;</span> <span class="identifier">y</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="identifier">quantity</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">R</span><span class="special">;</span>
+ <span class="identifier">R</span> <span class="identifier">r</span><span class="special">;</span>
+ <span class="identifier">r</span><span class="special">.</span><span class="identifier">set</span><span class="special">(</span><span class="identifier">x</span><span class="special">.</span><span class="identifier">get</span><span class="special">()</span> <span class="special">-</span> <span class="identifier">y</span><span class="special">.</span><span class="identifier">get</span><span class="special">());</span>
+ <span class="keyword">return</span> <span class="identifier">r</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ Example type-safe physics function
+ </p>
+<pre class="programlisting"><span class="identifier">Distance</span>
+<span class="identifier">compute_distance</span><span class="special">(</span><span class="identifier">Speed</span> <span class="identifier">v0</span><span class="special">,</span> <span class="identifier">Time</span> <span class="identifier">t</span><span class="special">,</span> <span class="identifier">Acceleration</span> <span class="identifier">a</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">v0</span> <span class="special">*</span> <span class="identifier">t</span> <span class="special">+</span> <span class="identifier">Scalar</span><span class="special">(.</span><span class="number">5</span><span class="special">)</span> <span class="special">*</span> <span class="identifier">a</span> <span class="special">*</span> <span class="identifier">t</span> <span class="special">*</span> <span class="identifier">t</span><span class="special">;</span> <span class="comment">// if a units mistake is made here it won't compile
+</span><span class="special">}</span>
+</pre>
+<p>
+ Exercise example type-safe physics function and show interoperation of custom
+ time durations (User1::seconds) and standard time durations (std::hours).
+ Though input can be arbitrary (but type-safe) units, output is always in
+ SI-units (a limitation of the simplified Units lib demoed here).
+ </p>
+<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">main</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">ratio</span><span class="special">&lt;</span><span class="number">8</span><span class="special">,</span> <span class="identifier">BOOST_INTMAX_C</span><span class="special">(</span><span class="number">0</span><span class="identifier">x7FFFFFFFD</span><span class="special">)&gt;</span> <span class="identifier">R1</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">3</span><span class="special">,</span> <span class="identifier">BOOST_INTMAX_C</span><span class="special">(</span><span class="number">0</span><span class="identifier">x7FFFFFFFD</span><span class="special">)&gt;</span> <span class="identifier">R2</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">User1</span><span class="special">::</span><span class="identifier">quantity</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio_subtract</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;,</span> <span class="identifier">boost</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="identifier">type</span><span class="special">,</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio_subtract</span><span class="special">&lt;</span><span class="identifier">boost</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="identifier">boost</span><span class="special">::</span><span class="identifier">ratio</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;</span> <span class="special">&gt;::</span><span class="identifier">type</span> <span class="special">&gt;</span> <span class="identifier">RR</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">ratio_subtract</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">type</span> <span class="identifier">RS</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">RS</span><span class="special">::</span><span class="identifier">num</span> <span class="special">&lt;&lt;</span> <span class="char">'/'</span> <span class="special">&lt;&lt;</span> <span class="identifier">RS</span><span class="special">::</span><span class="identifier">den</span> <span class="special">&lt;&lt;</span> <span class="char">'\n'</span><span class="special">;</span>
+
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"*************\n"</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"* testUser1 *\n"</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"*************\n"</span><span class="special">;</span>
+ <span class="identifier">User1</span><span class="special">::</span><span class="identifier">Distance</span> <span class="identifier">d</span><span class="special">(</span> <span class="identifier">User1</span><span class="special">::</span><span class="identifier">mile</span><span class="special">(</span><span class="number">110</span><span class="special">)</span> <span class="special">);</span>
+ <span class="identifier">User1</span><span class="special">::</span><span class="identifier">Time</span> <span class="identifier">t</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">hours</span><span class="special">(</span><span class="number">2</span><span class="special">)</span> <span class="special">);</span>
+
+ <span class="identifier">RR</span> <span class="identifier">r</span><span class="special">=</span><span class="identifier">d</span> <span class="special">/</span> <span class="identifier">t</span><span class="special">;</span>
+ <span class="comment">//r.set(d.get() / t.get());
+</span>
+ <span class="identifier">User1</span><span class="special">::</span><span class="identifier">Speed</span> <span class="identifier">rc</span><span class="special">=</span> <span class="identifier">r</span><span class="special">;</span>
+
+ <span class="identifier">User1</span><span class="special">::</span><span class="identifier">Speed</span> <span class="identifier">s</span> <span class="special">=</span> <span class="identifier">d</span> <span class="special">/</span> <span class="identifier">t</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Speed = "</span> <span class="special">&lt;&lt;</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">get</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="string">" meters/sec\n"</span><span class="special">;</span>
+ <span class="identifier">User1</span><span class="special">::</span><span class="identifier">Acceleration</span> <span class="identifier">a</span> <span class="special">=</span> <span class="identifier">User1</span><span class="special">::</span><span class="identifier">Distance</span><span class="special">(</span> <span class="identifier">User1</span><span class="special">::</span><span class="identifier">foot</span><span class="special">(</span><span class="number">32.2</span><span class="special">)</span> <span class="special">)</span> <span class="special">/</span> <span class="identifier">User1</span><span class="special">::</span><span class="identifier">Time</span><span class="special">()</span> <span class="special">/</span> <span class="identifier">User1</span><span class="special">::</span><span class="identifier">Time</span><span class="special">();</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Acceleration = "</span> <span class="special">&lt;&lt;</span> <span class="identifier">a</span><span class="special">.</span><span class="identifier">get</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="string">" meters/sec^2\n"</span><span class="special">;</span>
+ <span class="identifier">User1</span><span class="special">::</span><span class="identifier">Distance</span> <span class="identifier">df</span> <span class="special">=</span> <span class="identifier">compute_distance</span><span class="special">(</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">User1</span><span class="special">::</span><span class="identifier">Time</span><span class="special">(</span> <span class="identifier">User1</span><span class="special">::</span><span class="identifier">seconds</span><span class="special">(</span><span class="number">0.5</span><span class="special">)</span> <span class="special">),</span> <span class="identifier">a</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Distance = "</span> <span class="special">&lt;&lt;</span> <span class="identifier">df</span><span class="special">.</span><span class="identifier">get</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="string">" meters\n"</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"There are "</span> <span class="special">&lt;&lt;</span> <span class="identifier">User1</span><span class="special">::</span><span class="identifier">mile</span><span class="special">::</span><span class="identifier">ratio</span><span class="special">::</span><span class="identifier">den</span> <span class="special">&lt;&lt;</span> <span class="char">'/'</span> <span class="special">&lt;&lt;</span> <span class="identifier">User1</span><span class="special">::</span><span class="identifier">mile</span><span class="special">::</span><span class="identifier">ratio</span><span class="special">::</span><span class="identifier">num</span> <span class="special">&lt;&lt;</span> <span class="string">" miles/meter"</span><span class="special">;</span>
+ <span class="identifier">User1</span><span class="special">::</span><span class="identifier">meter</span> <span class="identifier">mt</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span>
+ <span class="identifier">User1</span><span class="special">::</span><span class="identifier">mile</span> <span class="identifier">mi</span> <span class="special">=</span> <span class="identifier">mt</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">" which is approximately "</span> <span class="special">&lt;&lt;</span> <span class="identifier">mi</span><span class="special">.</span><span class="identifier">count</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="char">'\n'</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"There are "</span> <span class="special">&lt;&lt;</span> <span class="identifier">User1</span><span class="special">::</span><span class="identifier">mile</span><span class="special">::</span><span class="identifier">ratio</span><span class="special">::</span><span class="identifier">num</span> <span class="special">&lt;&lt;</span> <span class="char">'/'</span> <span class="special">&lt;&lt;</span> <span class="identifier">User1</span><span class="special">::</span><span class="identifier">mile</span><span class="special">::</span><span class="identifier">ratio</span><span class="special">::</span><span class="identifier">den</span> <span class="special">&lt;&lt;</span> <span class="string">" meters/mile"</span><span class="special">;</span>
+ <span class="identifier">mi</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span>
+ <span class="identifier">mt</span> <span class="special">=</span> <span class="identifier">mi</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">" which is approximately "</span> <span class="special">&lt;&lt;</span> <span class="identifier">mt</span><span class="special">.</span><span class="identifier">count</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="char">'\n'</span><span class="special">;</span>
+ <span class="identifier">User1</span><span class="special">::</span><span class="identifier">attosecond</span> <span class="identifier">as</span><span class="special">(</span><span class="number">1</span><span class="special">);</span>
+ <span class="identifier">User1</span><span class="special">::</span><span class="identifier">seconds</span> <span class="identifier">sec</span> <span class="special">=</span> <span class="identifier">as</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"1 attosecond is "</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="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"sec = as; // compiles\n"</span><span class="special">;</span>
+ <span class="identifier">sec</span> <span class="special">=</span> <span class="identifier">User1</span><span class="special">::</span><span class="identifier">seconds</span><span class="special">(</span><span class="number">1</span><span class="special">);</span>
+ <span class="identifier">as</span> <span class="special">=</span> <span class="identifier">sec</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"1 second is "</span> <span class="special">&lt;&lt;</span> <span class="identifier">as</span><span class="special">.</span><span class="identifier">count</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="string">" attoseconds\n"</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"as = sec; // compiles\n"</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"\n"</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="number">0</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>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/simulated_thread_interface_demonstration_program.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/simulated_thread_interface_demonstration_program.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -0,0 +1,180 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>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="runtime_resolution.html" title="runtime_resolution">
+<link rel="next" href="saturating.html" title="Saturating">
+</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="runtime_resolution.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="saturating.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.simulated_thread_interface_demonstration_program"></a><a href="simulated_thread_interface_demonstration_program.html" title="Simulated
+ thread interface demonstration program">Simulated
+ thread interface demonstration program</a>
+</h3></div></div></div>
+<p>
+ Free sleep functions
+ </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">this_thread</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">void</span> <span class="identifier">sleep_for</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">boost</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;&amp;</span> <span class="identifier">d</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">microseconds</span> <span class="identifier">t</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">duration_cast</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">microseconds</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">t</span> <span class="special">&lt;</span> <span class="identifier">d</span><span class="special">)</span>
+ <span class="special">++</span><span class="identifier">t</span><span class="special">;</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">t</span> <span class="special">&gt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">chrono</span><span class="special">::</span><span class="identifier">microseconds</span><span class="special">(</span><span class="number">0</span><span class="special">))</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"sleep_for "</span> <span class="special">&lt;&lt;</span> <span class="identifier">t</span><span class="special">.</span><span class="identifier">count</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="string">" microseconds\n"</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">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration</span><span class="special">&gt;</span>
+<span class="keyword">void</span> <span class="identifier">sleep_until</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">boost</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">,</span> <span class="identifier">Duration</span><span class="special">&gt;&amp;</span> <span class="identifier">t</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">chrono</span><span class="special">;</span>
+ <span class="keyword">typedef</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;</span> <span class="identifier">Time</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">system_clock</span><span class="special">::</span><span class="identifier">time_point</span> <span class="identifier">SysTime</span><span class="special">;</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">t</span> <span class="special">&gt;</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="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">common_type</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Time</span><span class="special">::</span><span class="identifier">duration</span><span class="special">,</span>
+ <span class="keyword">typename</span> <span class="identifier">SysTime</span><span class="special">::</span><span class="identifier">duration</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">D</span><span class="special">;</span>
+ <span class="comment">/* auto */</span> <span class="identifier">D</span> <span class="identifier">d</span> <span class="special">=</span> <span class="identifier">t</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="identifier">microseconds</span> <span class="identifier">us</span> <span class="special">=</span> <span class="identifier">duration_cast</span><span class="special">&lt;</span><span class="identifier">microseconds</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">us</span> <span class="special">&lt;</span> <span class="identifier">d</span><span class="special">)</span>
+ <span class="special">++</span><span class="identifier">us</span><span class="special">;</span>
+ <span class="identifier">SysTime</span> <span class="identifier">st</span> <span class="special">=</span> <span class="identifier">system_clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">us</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"sleep_until "</span><span class="special">;</span>
+ <span class="identifier">detail</span><span class="special">::</span><span class="identifier">print_time</span><span class="special">(</span><span class="identifier">st</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">" which is "</span> <span class="special">&lt;&lt;</span> <span class="special">(</span><span class="identifier">st</span> <span class="special">-</span> <span class="identifier">system_clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">()).</span><span class="identifier">count</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="string">" microseconds away\n"</span><span class="special">;</span>
+ <span class="special">}</span>
+<span class="special">}</span>
+
+<span class="special">}}</span>
+</pre>
+<p>
+ timed_mutex modified fuctions
+ </p>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
+<span class="keyword">struct</span> <span class="identifier">timed_mutex</span> <span class="special">{</span>
+ <span class="comment">// ...
+</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">bool</span> <span class="identifier">try_lock_for</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">boost</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;&amp;</span> <span class="identifier">d</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">microseconds</span> <span class="identifier">t</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">duration_cast</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">microseconds</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">t</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">microseconds</span><span class="special">(</span><span class="number">0</span><span class="special">))</span>
+ <span class="keyword">return</span> <span class="identifier">try_lock</span><span class="special">();</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"try_lock_for "</span> <span class="special">&lt;&lt;</span> <span class="identifier">t</span><span class="special">.</span><span class="identifier">count</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="string">" microseconds\n"</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="keyword">true</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">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration</span><span class="special">&gt;</span>
+ <span class="keyword">bool</span> <span class="identifier">try_lock_until</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">boost</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">,</span> <span class="identifier">Duration</span><span class="special">&gt;&amp;</span> <span class="identifier">t</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">chrono</span><span class="special">;</span>
+ <span class="keyword">typedef</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;</span> <span class="identifier">Time</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">system_clock</span><span class="special">::</span><span class="identifier">time_point</span> <span class="identifier">SysTime</span><span class="special">;</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">t</span> <span class="special">&lt;=</span> <span class="identifier">Clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">())</span>
+ <span class="keyword">return</span> <span class="identifier">try_lock</span><span class="special">();</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">common_type</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Time</span><span class="special">::</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="identifier">type</span> <span class="identifier">D</span><span class="special">;</span>
+ <span class="comment">/* auto */</span> <span class="identifier">D</span> <span class="identifier">d</span> <span class="special">=</span> <span class="identifier">t</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="identifier">microseconds</span> <span class="identifier">us</span> <span class="special">=</span> <span class="identifier">duration_cast</span><span class="special">&lt;</span><span class="identifier">microseconds</span><span class="special">&gt;(</span><span class="identifier">d</span><span class="special">);</span>
+ <span class="identifier">SysTime</span> <span class="identifier">st</span> <span class="special">=</span> <span class="identifier">system_clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">us</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"try_lock_until "</span><span class="special">;</span>
+ <span class="identifier">detail</span><span class="special">::</span><span class="identifier">print_time</span><span class="special">(</span><span class="identifier">st</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">" which is "</span> <span class="special">&lt;&lt;</span> <span class="special">(</span><span class="identifier">st</span> <span class="special">-</span> <span class="identifier">system_clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">()).</span><span class="identifier">count</span><span class="special">()</span>
+ <span class="special">&lt;&lt;</span> <span class="string">" microseconds away\n"</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span>
+ <span class="special">}</span>
+<span class="special">};</span>
+<span class="special">}</span>
+</pre>
+<p>
+ condition_variable modified fuctions
+ </p>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
+<span class="keyword">struct</span> <span class="identifier">condition_variable</span>
+<span class="special">{</span>
+ <span class="comment">// ...
+</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">bool</span> <span class="identifier">wait_for</span><span class="special">(</span><span class="identifier">mutex</span><span class="special">&amp;,</span> <span class="keyword">const</span> <span class="identifier">boost</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;&amp;</span> <span class="identifier">d</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">microseconds</span> <span class="identifier">t</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">duration_cast</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">microseconds</span><span class="special">&gt;(</span><span class="identifier">d</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"wait_for "</span> <span class="special">&lt;&lt;</span> <span class="identifier">t</span><span class="special">.</span><span class="identifier">count</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="string">" microseconds\n"</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="keyword">true</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">Clock</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Duration</span><span class="special">&gt;</span>
+ <span class="keyword">bool</span> <span class="identifier">wait_until</span><span class="special">(</span><span class="identifier">mutex</span><span class="special">&amp;,</span> <span class="keyword">const</span> <span class="identifier">boost</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">,</span> <span class="identifier">Duration</span><span class="special">&gt;&amp;</span> <span class="identifier">t</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">chrono</span><span class="special">;</span>
+ <span class="keyword">typedef</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;</span> <span class="identifier">Time</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">system_clock</span><span class="special">::</span><span class="identifier">time_point</span> <span class="identifier">SysTime</span><span class="special">;</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">t</span> <span class="special">&lt;=</span> <span class="identifier">Clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">())</span>
+ <span class="keyword">return</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">common_type</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Time</span><span class="special">::</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="identifier">type</span> <span class="identifier">D</span><span class="special">;</span>
+ <span class="comment">/* auto */</span> <span class="identifier">D</span> <span class="identifier">d</span> <span class="special">=</span> <span class="identifier">t</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="identifier">microseconds</span> <span class="identifier">us</span> <span class="special">=</span> <span class="identifier">duration_cast</span><span class="special">&lt;</span><span class="identifier">microseconds</span><span class="special">&gt;(</span><span class="identifier">d</span><span class="special">);</span>
+ <span class="identifier">SysTime</span> <span class="identifier">st</span> <span class="special">=</span> <span class="identifier">system_clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">us</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"wait_until "</span><span class="special">;</span>
+ <span class="identifier">detail</span><span class="special">::</span><span class="identifier">print_time</span><span class="special">(</span><span class="identifier">st</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">" which is "</span> <span class="special">&lt;&lt;</span> <span class="special">(</span><span class="identifier">st</span> <span class="special">-</span> <span class="identifier">system_clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">()).</span><span class="identifier">count</span><span class="special">()</span>
+ <span class="special">&lt;&lt;</span> <span class="string">" microseconds away\n"</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span>
+ <span class="special">}</span>
+<span class="special">};</span>
+<span class="special">}</span>
+</pre>
+<p>
+ Usage
+ </p>
+<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mutex</span> <span class="identifier">m</span><span class="special">;</span>
+<span class="identifier">boost</span><span class="special">::</span><span class="identifier">timed_mutex</span> <span class="identifier">mut</span><span class="special">;</span>
+<span class="identifier">boost</span><span class="special">::</span><span class="identifier">condition_variable</span> <span class="identifier">cv</span><span class="special">;</span>
+
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">;</span>
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">chrono</span><span class="special">;</span>
+
+<span class="identifier">this_thread</span><span class="special">::</span><span class="identifier">sleep_for</span><span class="special">(</span><span class="identifier">seconds</span><span class="special">(</span><span class="number">3</span><span class="special">));</span>
+<span class="identifier">this_thread</span><span class="special">::</span><span class="identifier">sleep_for</span><span class="special">(</span><span class="identifier">nanoseconds</span><span class="special">(</span><span class="number">300</span><span class="special">));</span>
+<span class="identifier">system_clock</span><span class="special">::</span><span class="identifier">time_point</span> <span class="identifier">time_limit</span> <span class="special">=</span> <span class="identifier">system_clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">seconds</span><span class="special">(</span><span class="number">4</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">milliseconds</span><span class="special">(</span><span class="number">500</span><span class="special">);</span>
+<span class="identifier">this_thread</span><span class="special">::</span><span class="identifier">sleep_until</span><span class="special">(</span><span class="identifier">time_limit</span><span class="special">);</span>
+
+<span class="identifier">mut</span><span class="special">.</span><span class="identifier">try_lock_for</span><span class="special">(</span><span class="identifier">milliseconds</span><span class="special">(</span><span class="number">30</span><span class="special">));</span>
+<span class="identifier">mut</span><span class="special">.</span><span class="identifier">try_lock_until</span><span class="special">(</span><span class="identifier">time_limit</span><span class="special">);</span>
+
+<span class="identifier">cv</span><span class="special">.</span><span class="identifier">wait_for</span><span class="special">(</span><span class="identifier">m</span><span class="special">,</span> <span class="identifier">minutes</span><span class="special">(</span><span class="number">1</span><span class="special">));</span> <span class="comment">// real code would put this in a loop
+</span><span class="identifier">cv</span><span class="special">.</span><span class="identifier">wait_until</span><span class="special">(</span><span class="identifier">m</span><span class="special">,</span> <span class="identifier">time_limit</span><span class="special">);</span> <span class="comment">// real code would put this in a loop
+</span>
+<span class="comment">// For those who prefer floating point
+</span><span class="identifier">this_thread</span><span class="special">::</span><span class="identifier">sleep_for</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">0.25</span><span class="special">));</span>
+<span class="identifier">this_thread</span><span class="special">::</span><span class="identifier">sleep_until</span><span class="special">(</span><span class="identifier">system_clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">()</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.5</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="runtime_resolution.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="saturating.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/time_command.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/time_command.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -0,0 +1,82 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>time command</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_example2_cpp.html" title="run_timer_example2.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_example2_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.time_command"></a>time command
+</h3></div></div></div>
+<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">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">cstdlib</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">string</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iostream</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">if</span> <span class="special">(</span> <span class="identifier">argc</span> <span class="special">==</span> <span class="number">1</span> <span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"invoke: timex [-v] command [args...]\n"</span>
+ <span class="string">" command will be executed and timings displayed\n"</span>
+ <span class="string">" -v option causes command and args to be displayed\n"</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="number">1</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">s</span><span class="special">;</span>
+
+ <span class="keyword">bool</span> <span class="identifier">verbose</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="keyword">if</span> <span class="special">(</span> <span class="identifier">argc</span> <span class="special">&gt;</span> <span class="number">1</span> <span class="special">&amp;&amp;</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="char">'-'</span> <span class="special">&amp;&amp;</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="number">1</span><span class="special">)</span> <span class="special">==</span> <span class="char">'v'</span> <span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">verbose</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span>
+ <span class="special">++</span><span class="identifier">argv</span><span class="special">;</span>
+ <span class="special">--</span><span class="identifier">argc</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="keyword">for</span> <span class="special">(</span> <span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special">&lt;</span> <span class="identifier">argc</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span> <span class="special">)</span>
+ <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(</span> <span class="identifier">i</span> <span class="special">&gt;</span> <span class="number">1</span> <span class="special">)</span> <span class="identifier">s</span> <span class="special">+=</span> <span class="char">' '</span><span class="special">;</span>
+ <span class="identifier">s</span> <span class="special">+=</span> <span class="identifier">argv</span><span class="special">[</span><span class="identifier">i</span><span class="special">];</span>
+ <span class="special">}</span>
+
+ <span class="keyword">if</span> <span class="special">(</span> <span class="identifier">verbose</span> <span class="special">)</span>
+ <span class="special">{</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"command: \""</span> <span class="special">&lt;&lt;</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">c_str</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="string">"\"\n"</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">return</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">system</span><span class="special">(</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">c_str</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="run_timer_example2_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/xtime_clock.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/xtime_clock.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -0,0 +1,179 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>xtime_clock</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="xtime_conversions.html" title="xtime conversions">
+<link rel="next" href="runtime_resolution.html" title="runtime_resolution">
+</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="xtime_conversions.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="runtime_resolution.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.xtime_clock"></a>xtime_clock
+</h3></div></div></div>
+<p>
+ This example demonstrates the use of a timeval-like struct to be used as
+ the representation type for both duraiton and time_point.
+ </p>
+<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">xtime</span> <span class="special">{</span>
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="keyword">long</span> <span class="identifier">tv_sec</span><span class="special">;</span>
+ <span class="keyword">long</span> <span class="identifier">tv_usec</span><span class="special">;</span>
+
+ <span class="keyword">void</span> <span class="identifier">fixup</span><span class="special">()</span> <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">tv_usec</span> <span class="special">&lt;</span> <span class="number">0</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">tv_usec</span> <span class="special">+=</span> <span class="number">1000000</span><span class="special">;</span>
+ <span class="special">--</span><span class="identifier">tv_sec</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="special">}</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">explicit</span> <span class="identifier">xtime</span><span class="special">(</span><span class="keyword">long</span> <span class="identifier">sec</span><span class="special">,</span> <span class="keyword">long</span> <span class="identifier">usec</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">tv_sec</span> <span class="special">=</span> <span class="identifier">sec</span><span class="special">;</span>
+ <span class="identifier">tv_usec</span> <span class="special">=</span> <span class="identifier">usec</span><span class="special">;</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">tv_usec</span> <span class="special">&lt;</span> <span class="number">0</span> <span class="special">||</span> <span class="identifier">tv_usec</span> <span class="special">&gt;=</span> <span class="number">1000000</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">tv_sec</span> <span class="special">+=</span> <span class="identifier">tv_usec</span> <span class="special">/</span> <span class="number">1000000</span><span class="special">;</span>
+ <span class="identifier">tv_usec</span> <span class="special">%=</span> <span class="number">1000000</span><span class="special">;</span>
+ <span class="identifier">fixup</span><span class="special">();</span>
+ <span class="special">}</span>
+ <span class="special">}</span>
+
+ <span class="keyword">explicit</span> <span class="identifier">xtime</span><span class="special">(</span><span class="keyword">long</span> <span class="keyword">long</span> <span class="identifier">usec</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">tv_usec</span> <span class="special">=</span> <span class="keyword">static_cast</span><span class="special">&lt;</span><span class="keyword">long</span><span class="special">&gt;(</span><span class="identifier">usec</span> <span class="special">%</span> <span class="number">1000000</span><span class="special">);</span>
+ <span class="identifier">tv_sec</span> <span class="special">=</span> <span class="keyword">static_cast</span><span class="special">&lt;</span><span class="keyword">long</span><span class="special">&gt;(</span><span class="identifier">usec</span> <span class="special">/</span> <span class="number">1000000</span><span class="special">);</span>
+ <span class="identifier">fixup</span><span class="special">();</span>
+ <span class="special">}</span>
+
+ <span class="comment">// explicit
+</span> <span class="keyword">operator</span> <span class="keyword">long</span> <span class="keyword">long</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">{</span><span class="keyword">return</span> <span class="keyword">static_cast</span><span class="special">&lt;</span><span class="keyword">long</span> <span class="keyword">long</span><span class="special">&gt;(</span><span class="identifier">tv_sec</span><span class="special">)</span> <span class="special">*</span> <span class="number">1000000</span> <span class="special">+</span> <span class="identifier">tv_usec</span><span class="special">;}</span>
+
+ <span class="identifier">xtime</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">+=</span> <span class="special">(</span><span class="identifier">xtime</span> <span class="identifier">rhs</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">tv_sec</span> <span class="special">+=</span> <span class="identifier">rhs</span><span class="special">.</span><span class="identifier">tv_sec</span><span class="special">;</span>
+ <span class="identifier">tv_usec</span> <span class="special">+=</span> <span class="identifier">rhs</span><span class="special">.</span><span class="identifier">tv_usec</span><span class="special">;</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">tv_usec</span> <span class="special">&gt;=</span> <span class="number">1000000</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">tv_usec</span> <span class="special">-=</span> <span class="number">1000000</span><span class="special">;</span>
+ <span class="special">++</span><span class="identifier">tv_sec</span><span class="special">;</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>
+
+ <span class="identifier">xtime</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">-=</span> <span class="special">(</span><span class="identifier">xtime</span> <span class="identifier">rhs</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">tv_sec</span> <span class="special">-=</span> <span class="identifier">rhs</span><span class="special">.</span><span class="identifier">tv_sec</span><span class="special">;</span>
+ <span class="identifier">tv_usec</span> <span class="special">-=</span> <span class="identifier">rhs</span><span class="special">.</span><span class="identifier">tv_usec</span><span class="special">;</span>
+ <span class="identifier">fixup</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>
+
+ <span class="identifier">xtime</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">%=</span> <span class="special">(</span><span class="identifier">xtime</span> <span class="identifier">rhs</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">long</span> <span class="keyword">long</span> <span class="identifier">t</span> <span class="special">=</span> <span class="identifier">tv_sec</span> <span class="special">*</span> <span class="number">1000000</span> <span class="special">+</span> <span class="identifier">tv_usec</span><span class="special">;</span>
+ <span class="keyword">long</span> <span class="keyword">long</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">rhs</span><span class="special">.</span><span class="identifier">tv_sec</span> <span class="special">*</span> <span class="number">1000000</span> <span class="special">+</span> <span class="identifier">rhs</span><span class="special">.</span><span class="identifier">tv_usec</span><span class="special">;</span>
+ <span class="identifier">t</span> <span class="special">%=</span> <span class="identifier">r</span><span class="special">;</span>
+ <span class="identifier">tv_sec</span> <span class="special">=</span> <span class="keyword">static_cast</span><span class="special">&lt;</span><span class="keyword">long</span><span class="special">&gt;(</span><span class="identifier">t</span> <span class="special">/</span> <span class="number">1000000</span><span class="special">);</span>
+ <span class="identifier">tv_usec</span> <span class="special">=</span> <span class="keyword">static_cast</span><span class="special">&lt;</span><span class="keyword">long</span><span class="special">&gt;(</span><span class="identifier">t</span> <span class="special">%</span> <span class="number">1000000</span><span class="special">);</span>
+ <span class="identifier">fixup</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>
+
+ <span class="keyword">friend</span> <span class="identifier">xtime</span> <span class="keyword">operator</span><span class="special">+(</span><span class="identifier">xtime</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">xtime</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">x</span> <span class="special">+=</span> <span class="identifier">y</span><span class="special">;}</span>
+ <span class="keyword">friend</span> <span class="identifier">xtime</span> <span class="keyword">operator</span><span class="special">-(</span><span class="identifier">xtime</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">xtime</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">x</span> <span class="special">-=</span> <span class="identifier">y</span><span class="special">;}</span>
+ <span class="keyword">friend</span> <span class="identifier">xtime</span> <span class="keyword">operator</span><span class="special">%(</span><span class="identifier">xtime</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">xtime</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">x</span> <span class="special">%=</span> <span class="identifier">y</span><span class="special">;}</span>
+
+ <span class="keyword">friend</span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">==(</span><span class="identifier">xtime</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">xtime</span> <span class="identifier">y</span><span class="special">)</span>
+ <span class="special">{</span> <span class="keyword">return</span> <span class="special">(</span><span class="identifier">x</span><span class="special">.</span><span class="identifier">tv_sec</span> <span class="special">==</span> <span class="identifier">y</span><span class="special">.</span><span class="identifier">tv_sec</span> <span class="special">&amp;&amp;</span> <span class="identifier">x</span><span class="special">.</span><span class="identifier">tv_usec</span> <span class="special">==</span> <span class="identifier">y</span><span class="special">.</span><span class="identifier">tv_usec</span><span class="special">);</span> <span class="special">}</span>
+
+ <span class="keyword">friend</span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&lt;(</span><span class="identifier">xtime</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">xtime</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">x</span><span class="special">.</span><span class="identifier">tv_sec</span> <span class="special">==</span> <span class="identifier">y</span><span class="special">.</span><span class="identifier">tv_sec</span><span class="special">)</span>
+ <span class="keyword">return</span> <span class="special">(</span><span class="identifier">x</span><span class="special">.</span><span class="identifier">tv_usec</span> <span class="special">&lt;</span> <span class="identifier">y</span><span class="special">.</span><span class="identifier">tv_usec</span><span class="special">);</span>
+ <span class="keyword">return</span> <span class="special">(</span><span class="identifier">x</span><span class="special">.</span><span class="identifier">tv_sec</span> <span class="special">&lt;</span> <span class="identifier">y</span><span class="special">.</span><span class="identifier">tv_sec</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="keyword">friend</span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">!=(</span><span class="identifier">xtime</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">xtime</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="special">!(</span><span class="identifier">x</span> <span class="special">==</span> <span class="identifier">y</span><span class="special">);</span> <span class="special">}</span>
+ <span class="keyword">friend</span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&gt;</span> <span class="special">(</span><span class="identifier">xtime</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">xtime</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">y</span> <span class="special">&lt;</span> <span class="identifier">x</span><span class="special">;</span> <span class="special">}</span>
+ <span class="keyword">friend</span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&lt;=(</span><span class="identifier">xtime</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">xtime</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="special">!(</span><span class="identifier">y</span> <span class="special">&lt;</span> <span class="identifier">x</span><span class="special">);</span> <span class="special">}</span>
+ <span class="keyword">friend</span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">&gt;=(</span><span class="identifier">xtime</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">xtime</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="special">!(</span><span class="identifier">x</span> <span class="special">&lt;</span> <span class="identifier">y</span><span class="special">);</span> <span class="special">}</span>
+
+ <span class="keyword">friend</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">&lt;&lt;(</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">xtime</span> <span class="identifier">x</span><span class="special">)</span>
+ <span class="special">{</span><span class="keyword">return</span> <span class="identifier">os</span> <span class="special">&lt;&lt;</span> <span class="char">'{'</span> <span class="special">&lt;&lt;</span> <span class="identifier">x</span><span class="special">.</span><span class="identifier">tv_sec</span> <span class="special">&lt;&lt;</span> <span class="char">','</span> <span class="special">&lt;&lt;</span> <span class="identifier">x</span><span class="special">.</span><span class="identifier">tv_usec</span> <span class="special">&lt;&lt;</span> <span class="char">'}'</span><span class="special">;}</span>
+<span class="special">};</span>
+</pre>
+<p>
+ Clock based on timeval-like struct.
+ </p>
+<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">xtime_clock</span>
+<span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="identifier">xtime</span> <span class="identifier">rep</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">micro</span> <span class="identifier">period</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">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">boost</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">xtime_clock</span><span class="special">&gt;</span> <span class="identifier">time_point</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>
+ <span class="preprocessor">#if</span> <span class="identifier">defined</span><span class="special">(</span><span class="identifier">BOOST_CHRONO_WINDOWS_API</span><span class="special">)</span>
+ <span class="identifier">time_point</span> <span class="identifier">t</span><span class="special">(</span><span class="identifier">duration</span><span class="special">(</span><span class="identifier">xtime</span><span class="special">(</span><span class="number">0</span><span class="special">)));</span>
+ <span class="identifier">gettimeofday</span><span class="special">((</span><span class="identifier">timeval</span><span class="special">*)&amp;</span><span class="identifier">t</span><span class="special">,</span> <span class="number">0</span><span class="special">);</span>
+ <span class="keyword">return</span> <span class="identifier">t</span><span class="special">;</span>
+
+ <span class="preprocessor">#elif</span> <span class="identifier">defined</span><span class="special">(</span><span class="identifier">BOOST_CHRONO_MAC_API</span><span class="special">)</span>
+
+ <span class="identifier">time_point</span> <span class="identifier">t</span><span class="special">(</span><span class="identifier">duration</span><span class="special">(</span><span class="identifier">xtime</span><span class="special">(</span><span class="number">0</span><span class="special">)));</span>
+ <span class="identifier">gettimeofday</span><span class="special">((</span><span class="identifier">timeval</span><span class="special">*)&amp;</span><span class="identifier">t</span><span class="special">,</span> <span class="number">0</span><span class="special">);</span>
+ <span class="keyword">return</span> <span class="identifier">t</span><span class="special">;</span>
+
+ <span class="preprocessor">#elif</span> <span class="identifier">defined</span><span class="special">(</span><span class="identifier">BOOST_CHRONO_POSIX_API</span><span class="special">)</span>
+ <span class="comment">//time_point t(0,0);
+</span>
+ <span class="identifier">timespec</span> <span class="identifier">ts</span><span class="special">;</span>
+ <span class="special">::</span><span class="identifier">clock_gettime</span><span class="special">(</span> <span class="identifier">CLOCK_REALTIME</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">ts</span> <span class="special">);</span>
+
+ <span class="identifier">xtime</span> <span class="identifier">xt</span><span class="special">(</span> <span class="identifier">ts</span><span class="special">.</span><span class="identifier">tv_sec</span><span class="special">,</span> <span class="identifier">ts</span><span class="special">.</span><span class="identifier">tv_nsec</span><span class="special">/</span><span class="number">1000</span><span class="special">);</span>
+ <span class="keyword">return</span> <span class="identifier">time_point</span><span class="special">(</span><span class="identifier">duration</span><span class="special">(</span><span class="identifier">xt</span><span class="special">));</span>
+
+ <span class="preprocessor">#endif</span> <span class="comment">// POSIX
+</span> <span class="special">}</span>
+<span class="special">};</span>
+</pre>
+<p>
+ Usage of xtime_clock
+ </p>
+<pre class="programlisting"><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">chrono</span><span class="special">;</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"sizeof xtime_clock::time_point = "</span> <span class="special">&lt;&lt;</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="identifier">xtime_clock</span><span class="special">::</span><span class="identifier">time_point</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="char">'\n'</span><span class="special">;</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"sizeof xtime_clock::duration = "</span> <span class="special">&lt;&lt;</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="identifier">xtime_clock</span><span class="special">::</span><span class="identifier">duration</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="char">'\n'</span><span class="special">;</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"sizeof xtime_clock::rep = "</span> <span class="special">&lt;&lt;</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="identifier">xtime_clock</span><span class="special">::</span><span class="identifier">rep</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="char">'\n'</span><span class="special">;</span>
+<span class="identifier">xtime_clock</span><span class="special">::</span><span class="identifier">duration</span> <span class="identifier">delay</span><span class="special">(</span><span class="identifier">milliseconds</span><span class="special">(</span><span class="number">5</span><span class="special">));</span>
+<span class="identifier">xtime_clock</span><span class="special">::</span><span class="identifier">time_point</span> <span class="identifier">start</span> <span class="special">=</span> <span class="identifier">xtime_clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">();</span>
+<span class="keyword">while</span> <span class="special">(</span><span class="identifier">xtime_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">&lt;=</span> <span class="identifier">delay</span><span class="special">)</span> <span class="special">{}</span>
+<span class="identifier">xtime_clock</span><span class="special">::</span><span class="identifier">time_point</span> <span class="identifier">stop</span> <span class="special">=</span> <span class="identifier">xtime_clock</span><span class="special">::</span><span class="identifier">now</span><span class="special">();</span>
+<span class="identifier">xtime_clock</span><span class="special">::</span><span class="identifier">duration</span> <span class="identifier">elapsed</span> <span class="special">=</span> <span class="identifier">stop</span> <span class="special">-</span> <span class="identifier">start</span><span class="special">;</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"paused "</span> <span class="special">&lt;&lt;</span> <span class="identifier">nanoseconds</span><span class="special">(</span><span class="identifier">elapsed</span><span class="special">).</span><span class="identifier">count</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="string">" nanoseconds\n"</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="xtime_conversions.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="runtime_resolution.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/xtime_conversions.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/examples/xtime_conversions.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -0,0 +1,119 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>xtime conversions</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="cycle_count.html" title="Cycle count">
+<link rel="next" href="xtime_clock.html" title="xtime_clock">
+</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="cycle_count.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="xtime_clock.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.xtime_conversions"></a>xtime conversions
+</h3></div></div></div>
+<p>
+ Example round_up utility: converts d to To, rounding up for inexact conversions
+ Being able to <span class="bold"><strong>easily</strong></span> write this function
+ is a major feature!
+ </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">chrono</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">hpp</span><span class="special">&gt;</span>
+
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iostream</span><span class="special">&gt;</span>
+
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</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">To</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">To</span>
+<span class="identifier">round_up</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="identifier">To</span> <span class="identifier">result</span> <span class="special">=</span> <span class="identifier">duration_cast</span><span class="special">&lt;</span><span class="identifier">To</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">result</span> <span class="special">&lt;</span> <span class="identifier">d</span><span class="special">)</span>
+ <span class="special">++</span><span class="identifier">result</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="identifier">result</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ Demonstrate interaction with xtime-like facility:
+ </p>
+<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">xtime</span>
+<span class="special">{</span>
+ <span class="keyword">long</span> <span class="identifier">sec</span><span class="special">;</span>
+ <span class="keyword">unsigned</span> <span class="keyword">long</span> <span class="identifier">usec</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">Rep</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period</span><span class="special">&gt;</span>
+<span class="identifier">xtime</span>
+<span class="identifier">to_xtime_truncate</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="identifier">xtime</span> <span class="identifier">xt</span><span class="special">;</span>
+ <span class="identifier">xt</span><span class="special">.</span><span class="identifier">sec</span> <span class="special">=</span> <span class="keyword">static_cast</span><span class="special">&lt;</span><span class="keyword">long</span><span class="special">&gt;(</span><span class="identifier">duration_cast</span><span class="special">&lt;</span><span class="identifier">seconds</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="identifier">xt</span><span class="special">.</span><span class="identifier">usec</span> <span class="special">=</span> <span class="keyword">static_cast</span><span class="special">&lt;</span><span class="keyword">long</span><span class="special">&gt;(</span><span class="identifier">duration_cast</span><span class="special">&lt;</span><span class="identifier">microseconds</span><span class="special">&gt;(</span><span class="identifier">d</span> <span class="special">-</span> <span class="identifier">seconds</span><span class="special">(</span><span class="identifier">xt</span><span class="special">.</span><span class="identifier">sec</span><span class="special">)).</span><span class="identifier">count</span><span class="special">());</span>
+ <span class="keyword">return</span> <span class="identifier">xt</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">Rep</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Period</span><span class="special">&gt;</span>
+<span class="identifier">xtime</span>
+<span class="identifier">to_xtime_round_up</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="identifier">xtime</span> <span class="identifier">xt</span><span class="special">;</span>
+ <span class="identifier">xt</span><span class="special">.</span><span class="identifier">sec</span> <span class="special">=</span> <span class="keyword">static_cast</span><span class="special">&lt;</span><span class="keyword">long</span><span class="special">&gt;(</span><span class="identifier">duration_cast</span><span class="special">&lt;</span><span class="identifier">seconds</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="identifier">xt</span><span class="special">.</span><span class="identifier">usec</span> <span class="special">=</span> <span class="keyword">static_cast</span><span class="special">&lt;</span><span class="keyword">unsigned</span> <span class="keyword">long</span><span class="special">&gt;(</span><span class="identifier">round_up</span><span class="special">&lt;</span><span class="identifier">microseconds</span><span class="special">&gt;(</span><span class="identifier">d</span> <span class="special">-</span> <span class="identifier">seconds</span><span class="special">(</span><span class="identifier">xt</span><span class="special">.</span><span class="identifier">sec</span><span class="special">)).</span><span class="identifier">count</span><span class="special">());</span>
+ <span class="keyword">return</span> <span class="identifier">xt</span><span class="special">;</span>
+<span class="special">}</span>
+
+<span class="identifier">microseconds</span>
+<span class="identifier">from_xtime</span><span class="special">(</span><span class="identifier">xtime</span> <span class="identifier">xt</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">seconds</span><span class="special">(</span><span class="identifier">xt</span><span class="special">.</span><span class="identifier">sec</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">microseconds</span><span class="special">(</span><span class="identifier">xt</span><span class="special">.</span><span class="identifier">usec</span><span class="special">);</span>
+<span class="special">}</span>
+
+<span class="keyword">void</span> <span class="identifier">print</span><span class="special">(</span><span class="identifier">xtime</span> <span class="identifier">xt</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="char">'{'</span> <span class="special">&lt;&lt;</span> <span class="identifier">xt</span><span class="special">.</span><span class="identifier">sec</span> <span class="special">&lt;&lt;</span> <span class="char">','</span> <span class="special">&lt;&lt;</span> <span class="identifier">xt</span><span class="special">.</span><span class="identifier">usec</span> <span class="special">&lt;&lt;</span> <span class="string">"}\n"</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ Usage
+ </p>
+<pre class="programlisting"><span class="identifier">xtime</span> <span class="identifier">xt</span> <span class="special">=</span> <span class="identifier">to_xtime_truncate</span><span class="special">(</span><span class="identifier">seconds</span><span class="special">(</span><span class="number">3</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">milliseconds</span><span class="special">(</span><span class="number">251</span><span class="special">));</span>
+<span class="identifier">print</span><span class="special">(</span><span class="identifier">xt</span><span class="special">);</span>
+<span class="identifier">milliseconds</span> <span class="identifier">ms</span> <span class="special">=</span> <span class="identifier">duration_cast</span><span class="special">&lt;</span><span class="identifier">milliseconds</span><span class="special">&gt;(</span><span class="identifier">from_xtime</span><span class="special">(</span><span class="identifier">xt</span><span class="special">));</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">ms</span><span class="special">.</span><span class="identifier">count</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="string">" milliseconds\n"</span><span class="special">;</span>
+<span class="identifier">xt</span> <span class="special">=</span> <span class="identifier">to_xtime_round_up</span><span class="special">(</span><span class="identifier">ms</span><span class="special">);</span>
+<span class="identifier">print</span><span class="special">(</span><span class="identifier">xt</span><span class="special">);</span>
+<span class="identifier">xt</span> <span class="special">=</span> <span class="identifier">to_xtime_truncate</span><span class="special">(</span><span class="identifier">seconds</span><span class="special">(</span><span class="number">3</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">nanoseconds</span><span class="special">(</span><span class="number">999</span><span class="special">));</span>
+<span class="identifier">print</span><span class="special">(</span><span class="identifier">xt</span><span class="special">);</span>
+<span class="identifier">xt</span> <span class="special">=</span> <span class="identifier">to_xtime_round_up</span><span class="special">(</span><span class="identifier">seconds</span><span class="special">(</span><span class="number">3</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">nanoseconds</span><span class="special">(</span><span class="number">999</span><span class="special">));</span>
+<span class="identifier">print</span><span class="special">(</span><span class="identifier">xt</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="cycle_count.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="xtime_clock.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Modified: sandbox/chrono/libs/chrono/doc/html/boost_chrono/overview.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/boost_chrono/overview.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/overview.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -40,7 +40,7 @@
 <dt><span class="section">Caveat emptor</span></dt>
 </dl></div>
 <a name="boost_chrono.overview.description"></a><h3>
-<a name="id4762284"></a>
+<a name="id4762357"></a>
       <a href="overview.html#boost_chrono.overview.description">Description</a>
     </h3>
 <p>
@@ -99,7 +99,7 @@
 </li>
 </ul></div>
 <a name="boost_chrono.overview.how_to_use_this_documentation"></a><h3>
-<a name="id4764874"></a>
+<a name="id4764955"></a>
       <a href="overview.html#boost_chrono.overview.how_to_use_this_documentation">How to
       Use This Documentation</a>
     </h3>
@@ -151,12 +151,12 @@
 <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>
+<pre class="programlisting"><span class="comment">// Include all of Chrono files
+</span><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">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>
+<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">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">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>
 </pre>
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>

Added: sandbox/chrono/libs/chrono/doc/html/boost_chrono/overview/caveat_emptor.html
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/overview/caveat_emptor.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -0,0 +1,51 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Caveat emptor</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="motivation.html" title="Motivation">
+<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="motivation.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.caveat_emptor"></a>Caveat emptor
+</h3></div></div></div>
+<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>
+</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="motivation.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>

Modified: sandbox/chrono/libs/chrono/doc/html/boost_chrono/overview/motivation.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/boost_chrono/overview/motivation.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/overview/motivation.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -197,13 +197,12 @@
           always represent any value minutes has.
         </p>
 <p>
- In Boost.DateTime, these units are united via inheritance. __Boost<span class="underline">Chrono</span>_ instead unites these units through
- the class template <code class="computeroutput"><span class="identifier">duration</span></code>.
- That is, in __Boost<span class="underline">Chrono</span>_ 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.
+ In Boost.DateTime, these units are united via inheritance. <span class="bold"><strong>Boost.Chrono</strong></span>
+ instead unites these units through the class template <code class="computeroutput"><span class="identifier">duration</span></code>.
+ That is, in <span class="bold"><strong>Boost.Chrono</strong></span> 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
@@ -231,7 +230,7 @@
           possible, can be a significant performance advantage.
         </p>
 <p>
- __Boost<span class="underline">Chrono</span>_ continues, and generalizes
+ <span class="bold"><strong>Boost.Chrono</strong></span> 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
@@ -240,7 +239,7 @@
           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="id4759064"></a>
+<a name="id4759410"></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>
@@ -298,7 +297,7 @@
           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="id4759770"></a>
+<a name="id4758314"></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>
@@ -314,7 +313,7 @@
           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="id4759923"></a>
+<a name="id4813058"></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>
@@ -334,7 +333,7 @@
           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="id4813064"></a>
+<a name="id4813194"></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>
@@ -349,7 +348,7 @@
 <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="id4813226"></a>
+<a name="id4813357"></a>
           <a href="motivation.html#boost_chrono.overview.motivation.duration.how_expensive_is_all_of_this_">How
           expensive is all of this?</a>
         </h5>
@@ -363,7 +362,7 @@
           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="id4813276"></a>
+<a name="id4813407"></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>
@@ -485,8 +484,7 @@
           </li>
 </ol></div>
 <p>
- __Boost<span class="underline">Chrono</span>_ proposes 3 concrete
- clocks:
+ <span class="bold"><strong>Boost.Chrono</strong></span> proposes 3 concrete clocks:
         </p>
 <div class="orderedlist"><ol type="1">
 <li>
@@ -577,16 +575,16 @@
           of the epoch no longer has meaning.
         </p>
 <p>
- In __Boost<span class="underline">Chrono</span>_, 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
+ In <span class="bold"><strong>Boost.Chrono</strong></span>, 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="id4815082"></a>
+<a name="id4815212"></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>

Modified: sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Reference</title>
+<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">
@@ -24,7 +24,7 @@
 </div>
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="boost_chrono.reference"></a>Reference
+<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>

Modified: sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/chrono_hpp.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/chrono_hpp.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/chrono_hpp.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -5,7 +5,7 @@
 <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="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>
@@ -320,7 +320,7 @@
           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="id4829308"></a><p class="title"><b>Table 1. Clock Requirements</b></p>
+<a name="id4829407"></a><p class="title"><b>Table 1. Clock Requirements</b></p>
 <table class="table" summary="Clock Requirements">
 <colgroup>
 <col>

Modified: sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/common_type_hpp.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/common_type_hpp.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/common_type_hpp.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -5,8 +5,8 @@
 <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="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">

Modified: sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/process_times_hpp.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/process_times_hpp.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/process_times_hpp.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -5,7 +5,7 @@
 <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="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>

Modified: sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/ratio_hpp.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/ratio_hpp.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/ratio_hpp.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -5,7 +5,7 @@
 <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="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>

Modified: sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/timer_hpp.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/timer_hpp.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/reference/timer_hpp.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -5,7 +5,7 @@
 <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="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>

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-12 13:56:30 EST (Sat, 12 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>

Modified: sandbox/chrono/libs/chrono/doc/html/boost_chrono/users_guide/ext_references.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/boost_chrono/users_guide/ext_references.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/users_guide/ext_references.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -7,7 +7,7 @@
 <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">
+<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>

Modified: sandbox/chrono/libs/chrono/doc/html/boost_chrono/users_guide/getting_started.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/boost_chrono/users_guide/getting_started.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/boost_chrono/users_guide/getting_started.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -38,13 +38,13 @@
         Installing Chrono">
         Installing Chrono</a>
 </h4></div></div></div>
-<a name="boost_chrono.users_guide.getting_started.install.getting___boost_emphasis_role__underline__chrono__emphasis__"></a><h5>
-<a name="id4816069"></a>
- <a href="getting_started.html#boost_chrono.users_guide.getting_started.install.getting___boost_emphasis_role__underline__chrono__emphasis__">Getting
- __Boost<span class="underline">Chrono</span>_</a>
+<a name="boost_chrono.users_guide.getting_started.install.getting__emphasis_role__bold__boost_chrono__emphasis__"></a><h5>
+<a name="id4816056"></a>
+ <a href="getting_started.html#boost_chrono.users_guide.getting_started.install.getting__emphasis_role__bold__boost_chrono__emphasis__">Getting
+ <span class="bold"><strong>Boost.Chrono</strong></span> </a>
         </h5>
 <p>
- You can get the last stable release of __Boost<span class="underline">Chrono</span>_
+ You can get the last stable release of <span class="bold"><strong>Boost.Chrono</strong></span>
           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>
@@ -52,19 +52,35 @@
           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_emphasis_role__underline__chrono__emphasis__"></a><h5>
-<a name="id4816129"></a>
- <a href="getting_started.html#boost_chrono.users_guide.getting_started.install.building___boost_emphasis_role__underline__chrono__emphasis__">Building
- __Boost<span class="underline">Chrono</span>_</a>
+<a name="boost_chrono.users_guide.getting_started.install.where_to_install__emphasis_role__bold__boost_chrono__emphasis___"></a><h5>
+<a name="id4816117"></a>
+ <a href="getting_started.html#boost_chrono.users_guide.getting_started.install.where_to_install__emphasis_role__bold__boost_chrono__emphasis___">Where
+ to install <span class="bold"><strong>Boost.Chrono</strong></span>? </a>
         </h5>
 <p>
- __Boost<span class="underline">Chrono</span>_ is not a header only
- library. You need to compile it before use.
+ The simple way is to decompress (or checkout from SVN) the file in your
+ BOOST_ROOT directory.
+ </p>
+<p>
+ Othesewise, if you decompress in another directory, you will need to comment
+ some lines, and uncomment and change others in the build/Jamfile and test/Jamfile.
+ Sorry for this, but I have not reached yet to write a Jamfile that is able
+ to work in both environements and use the BOOST_ROOT variable. Any help
+ is welcome.
+ </p>
+<a name="boost_chrono.users_guide.getting_started.install.building__emphasis_role__bold__boost_chrono__emphasis__"></a><h5>
+<a name="id4816159"></a>
+ <a href="getting_started.html#boost_chrono.users_guide.getting_started.install.building__emphasis_role__bold__boost_chrono__emphasis__">Building
+ <span class="bold"><strong>Boost.Chrono</strong></span> </a>
+ </h5>
+<p>
+ <span class="bold"><strong>Boost.Chrono</strong></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="id4816195"></a>
+<a name="id4816227"></a>
           <a href="getting_started.html#boost_chrono.users_guide.getting_started.install.requirements">Requirements</a>
         </h5>
 <p>
@@ -73,8 +89,7 @@
           version in SVN trunk (even if older version should works also).
         </p>
 <p>
- In particular, __Boost<span class="underline">Chrono</span>_ depends
- on:
+ In particular, <span class="bold"><strong>Boost.Chrono</strong></span> depends on:
         </p>
 <div class="variablelist">
 <p class="title"><b></b></p>
@@ -87,13 +102,17 @@
 <dd><p>
               for throw_exception, ...
             </p></dd>
+<dt><span class="term">Boost.Integer</span></dt>
+<dd><p>
+ for cstdint conformance, ...
+ </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 ..., ...
+ for is_base, ...
             </p></dd>
 <dt><span class="term">Boost.Typeof</span></dt>
 <dd><p>
@@ -105,65 +124,64 @@
             </p></dd>
 </dl>
 </div>
-<a name="boost_chrono.users_guide.getting_started.install.exceptions_safety"></a><h5>
-<a name="id4816358"></a>
- <a href="getting_started.html#boost_chrono.users_guide.getting_started.install.exceptions_safety">Exceptions
- safety</a>
+<a name="boost_chrono.users_guide.getting_started.install.building_an_executable_that_uses__emphasis_role__bold__boost_chrono__emphasis__"></a><h5>
+<a name="id4816408"></a>
+ <a href="getting_started.html#boost_chrono.users_guide.getting_started.install.building_an_executable_that_uses__emphasis_role__bold__boost_chrono__emphasis__">Building
+ an executable that uses <span class="bold"><strong>Boost.Chrono</strong></span>
+ </a>
+ </h5>
+<p>
+ In addition to link with the Boost Chrono library you need also to link
+ with the Boost System library.
+ </p>
+<a name="boost_chrono.users_guide.getting_started.install.exceptions_safety_"></a><h5>
+<a name="id4816444"></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="id4816384"></a>
- <a href="getting_started.html#boost_chrono.users_guide.getting_started.install.thread_safety">Thread
- safety</a>
+<a name="boost_chrono.users_guide.getting_started.install.thread_safety_"></a><h5>
+<a name="id4816471"></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="id4816408"></a>
- <a href="getting_started.html#boost_chrono.users_guide.getting_started.install.tested_compilers">Tested
- compilers</a>
+<a name="boost_chrono.users_guide.getting_started.install.tested_compilers_"></a><h5>
+<a name="id4816495"></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
+ On Windows with
         </p>
 <div class="itemizedlist"><ul type="disc"><li>
- GCC 4.2.4
+ VC++ 9.0 SP1
           </li></ul></div>
 <p>
- On SL Linux with
+ On Cygwin with
         </p>
 <div class="itemizedlist"><ul type="disc">
 <li>
- GCC 3.4.6
+ GCC 3.4.4
           </li>
 <li>
- GCC 4.1.2
+ GCC 4.3.2
           </li>
 </ul></div>
 <p>
- On Cygwin with
+ On MinGW with
         </p>
 <div class="itemizedlist"><ul type="disc"><li>
- GCC 3.4.4
+ GCC 4.4.0
           </li></ul></div>
 <div class="note"><table border="0" summary="Note">
 <tr>
@@ -171,6 +189,15 @@
 <th align="left">Note</th>
 </tr>
 <tr><td align="left" valign="top"><p>
+ Please let me know how this works on other platforms.
+ </p></td></tr>
+</table></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>

Modified: sandbox/chrono/libs/chrono/doc/html/index.html
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/index.html (original)
+++ sandbox/chrono/libs/chrono/doc/html/index.html 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -38,7 +38,7 @@
 <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>
+<a name="id4803142"></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>
@@ -60,7 +60,7 @@
 <dt><span class="section">Tutorial</span></dt>
 <dt><span class="section"> References</span></dt>
 </dl></dd>
-<dt><span class="section">Reference</span></dt>
+<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>
@@ -75,17 +75,19 @@
       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 conversions</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">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>
+<dt><span class="section">time command</span></dt>
 </dl></dd>
 <dt><span class="section">Appendices</span></dt>
 <dd><dl>
@@ -114,7 +116,7 @@
 </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 21:37:24 GMT</small></p></td>
+<td align="left"><p><small>Last revised: December 12, 2009 at 18:38:26 GMT</small></p></td>
 <td align="right"><div class="copyright-footer"></div></td>
 </tr></table>
 <hr>

Modified: sandbox/chrono/libs/chrono/doc/html/standalone_HTML.manifest
==============================================================================
--- sandbox/chrono/libs/chrono/doc/html/standalone_HTML.manifest (original)
+++ sandbox/chrono/libs/chrono/doc/html/standalone_HTML.manifest 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -17,6 +17,7 @@
 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_conversions.html
 boost_chrono/examples/xtime_clock.html
 boost_chrono/examples/runtime_resolution.html
 boost_chrono/examples/simulated_thread_interface_demonstration_program.html
@@ -25,6 +26,7 @@
 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/examples/time_command.html
 boost_chrono/appendices.html
 boost_chrono/appendices/history.html
 boost_chrono/appendices/rationale.html

Modified: sandbox/chrono/libs/chrono/example/run_timer_example2.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/run_timer_example2.cpp (original)
+++ sandbox/chrono/libs/chrono/example/run_timer_example2.cpp 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -1,13 +1,13 @@
-// run_timer_example2.cpp --------------------------------------------------//
+// run_timer_example.cpp ---------------------------------------------------//
 
-// Copyright Beman Dawes 2006
+// Copyright Beman Dawes 2006, 2008
 
-// 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)
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
 
-// See http://www.boost.org/libs/system for documentation.
+// See http://www.boost.org/libs/chrono for documentation.
 
-#include <boost/system/timer.hpp>
+#include <boost/chrono/process_times.hpp>
 #include <cmath>
 
 int main( int argc, char * argv[] )
@@ -15,7 +15,7 @@
   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 );
+ boost::chrono::run_timer t( format, places );
 
   for ( long i = 0; i < 10000000; ++i )
     std::sqrt( 123.456L ); // burn some time

Modified: sandbox/chrono/libs/chrono/example/simulated_thread_interface_demo.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/simulated_thread_interface_demo.cpp (original)
+++ sandbox/chrono/libs/chrono/example/simulated_thread_interface_demo.cpp 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -36,43 +36,14 @@
 #include <stdexcept>
 #include <climits>
 
-#if defined(BOOST_CHRONO_WINDOWS_API)
-#include <windows.h>
-
-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 /////////////////
 //////////////////////////////////////////////////////////
 
-namespace std {
+namespace boost {
 
-void __print_time(boost::chrono::system_clock::time_point t)
+namespace detail {
+void print_time(boost::chrono::system_clock::time_point t)
 {
     using namespace boost::chrono;
     time_t c_time = system_clock::to_time_t(t);
@@ -81,7 +52,7 @@
     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>
@@ -110,7 +81,7 @@
             ++us;
         SysTime st = system_clock::now() + us;
         std::cout << "sleep_until ";
- __print_time(st);
+ boost::detail::print_time(st);
         std::cout << " which is " << (st - system_clock::now()).count() << " microseconds away\n";
     }
 }
@@ -147,7 +118,7 @@
         microseconds us = duration_cast<microseconds>(d);
         SysTime st = system_clock::now() + us;
         std::cout << "try_lock_until ";
- __print_time(st);
+ boost::detail::print_time(st);
         std::cout << " which is " << (st - system_clock::now()).count()
           << " microseconds away\n";
         return true;
@@ -178,27 +149,27 @@
         microseconds us = duration_cast<microseconds>(d);
         SysTime st = system_clock::now() + us;
          std::cout << "wait_until ";
- __print_time(st);
+ boost::detail::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;
+boost::mutex m;
+boost::timed_mutex mut;
+boost::condition_variable cv;
 
 void basic_examples()
 {
     std::cout << "Running basic examples\n";
- using namespace std;
+ using namespace boost;
     using namespace boost::chrono;
     system_clock::time_point time_limit = system_clock::now() + seconds(4) + milliseconds(500);
     this_thread::sleep_for(seconds(3));

Modified: sandbox/chrono/libs/chrono/example/timeval_demo.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/timeval_demo.cpp (original)
+++ sandbox/chrono/libs/chrono/example/timeval_demo.cpp 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -35,6 +35,34 @@
 # include <windows.h>
 #endif
 
+#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
+
 // timeval clock demo
 // Demonstrate the use of a timeval-like struct to be used as the representation
 // type for both duraiton and time_point.
@@ -136,34 +164,6 @@
     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()

Modified: sandbox/chrono/libs/chrono/example/timex.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/timex.cpp (original)
+++ sandbox/chrono/libs/chrono/example/timex.cpp 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -7,7 +7,7 @@
 
 // See http://www.boost.org/libs/system for documentation.
 
-#include <boost/system/timer.hpp>
+#include <boost/chrono/process_times.hpp>
 #include <cstdlib>
 #include <string>
 #include <iostream>
@@ -41,7 +41,7 @@
   if ( verbose )
     { std::cout << "command: \"" << s.c_str() << "\"\n"; }
 
- boost::system::run_timer t;
+ boost::chrono::run_timer t;
 
   return std::system( s.c_str() );
 }

Modified: sandbox/chrono/libs/chrono/example/xtime.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/xtime.cpp (original)
+++ sandbox/chrono/libs/chrono/example/xtime.cpp 2009-12-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -47,8 +47,6 @@
 
 // demonstrate interaction with xtime-like facility:
 
-using namespace boost::chrono;
-
 struct xtime
 {
     long sec;

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-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -79,6 +79,10 @@
         :
         [ run ../example/run_timer_example.cpp : : : <link>static ]
         [ run ../example/run_timer_example.cpp : : : <library>/boost/system//boost_system : run_timer_example_dll ]
+ [ run ../example/run_timer_example2.cpp : : : <link>static ]
+ [ run ../example/run_timer_example2.cpp : : : <library>/boost/system//boost_system : run_timer_example2_dll ]
+ [ link ../example/timex.cpp : <link>static ]
+ [ link ../example/timex.cpp : <library>/boost/system//boost_system : timex_dll ]
         [ run run_timer_test.cpp : : : <link>static ]
         [ run run_timer_test.cpp : : : <library>/boost/system//boost_system : run_timer_test_dll ]
         ;

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-12 13:56:30 EST (Sat, 12 Dec 2009)
@@ -43,7 +43,7 @@
 // and taking advantage of the std::ratio infrastructure and design philosophy.
 
 // length - mimics std::chrono::duration except restricts representation to double.
-// Uses std::ratio facilities for length units conversions.
+// Uses boost::ratio facilities for length units conversions.
 
 template <class Ratio>
 class length
@@ -153,9 +153,6 @@
 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)
@@ -230,7 +227,7 @@
     
     //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;
+ RR r=d / t;
     //r.set(d.get() / t.get());
     
     User1::Speed rc= r;


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