$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r58307 - in sandbox/chrono/libs/chrono: example src/posix
From: vicente.botet_at_[hidden]
Date: 2009-12-11 17:40:13
Author: viboes
Date: 2009-12-11 17:40:12 EST (Fri, 11 Dec 2009)
New Revision: 58307
URL: http://svn.boost.org/trac/boost/changeset/58307
Log:
Boost.Chrono: Version 0.2.5, Bug fixes
* complete qualification boost::chrono::duration to avoid possible BUG in gcc-4.4.0 reporting the following 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> >'
* cleanup of simulated...
* warning removal on posic/process_clock.cpp
Text files modified: 
   sandbox/chrono/libs/chrono/example/runtime_resolution.cpp              |     3                                         
   sandbox/chrono/libs/chrono/example/simulated_thread_interface_demo.cpp |   752 --------------------------------------- 
   sandbox/chrono/libs/chrono/src/posix/process_clock.cpp                 |     2                                         
   3 files changed, 4 insertions(+), 753 deletions(-)
Modified: sandbox/chrono/libs/chrono/example/runtime_resolution.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/runtime_resolution.cpp	(original)
+++ sandbox/chrono/libs/chrono/example/runtime_resolution.cpp	2009-12-11 17:40:12 EST (Fri, 11 Dec 2009)
@@ -168,10 +168,11 @@
     friend duration operator-(time_point x, time_point y) {return duration(x.rep_ - y.rep_);}
 };
 
+
 class clock
 {
 public:
-    typedef duration::rep rep;
+    typedef runtime_resolution::duration::rep rep;
     typedef runtime_resolution::duration duration;
     typedef runtime_resolution::time_point time_point;
 
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-11 17:40:12 EST (Fri, 11 Dec 2009)
@@ -219,759 +219,9 @@
 
 
 
-//////////////////////////////////////////////////////////
-//////////////////// User2 Example ///////////////////////
-//////////////////////////////////////////////////////////
-
-// Demonstrate User2:
-// A "saturating" signed integral type  is developed.  This type has +/- infinity and a nan
-// (like IEEE floating point) but otherwise obeys signed integral arithmetic.
-// This class is subsequently used as the rep in boost::chrono::duration to demonstrate a
-// duration class that does not silently ignore overflow.
-
-namespace User2
-{
-
-template <class I>
-class saturate
-{
-public:
-    typedef I int_type;
-
-    static const int_type nan = int_type(int_type(1) << (sizeof(int_type) * CHAR_BIT - 1));
-    static const int_type neg_inf = nan + 1;
-    static const int_type pos_inf = -neg_inf;
-private:
-    int_type i_;
-
-//     static_assert(std::is_integral<int_type>::value && std::is_signed<int_type>::value,
-//                   "saturate only accepts signed integral types");
-//     static_assert(nan == -nan && neg_inf < pos_inf,
-//                   "saturate assumes two's complement hardware for signed integrals");
-
-public:
-    saturate() : i_(nan) {}
-    explicit saturate(int_type i) : i_(i) {}
-    // explicit
-       operator int_type() const;
-
-    saturate& operator+=(saturate x);
-    saturate& operator-=(saturate x) {return *this += -x;}
-    saturate& operator*=(saturate x);
-    saturate& operator/=(saturate x);
-    saturate& operator%=(saturate x);
-
-    saturate  operator- () const {return saturate(-i_);}
-    saturate& operator++()       {*this += saturate(int_type(1)); return *this;}
-    saturate  operator++(int)    {saturate tmp(*this); ++(*this); return tmp;}
-    saturate& operator--()       {*this -= saturate(int_type(1)); return *this;}
-    saturate  operator--(int)    {saturate tmp(*this); --(*this); return tmp;}
-
-    friend saturate operator+(saturate x, saturate y) {return x += y;}
-    friend saturate operator-(saturate x, saturate y) {return x -= y;}
-    friend saturate operator*(saturate x, saturate y) {return x *= y;}
-    friend saturate operator/(saturate x, saturate y) {return x /= y;}
-    friend saturate operator%(saturate x, saturate y) {return x %= y;}
-
-    friend bool operator==(saturate x, saturate y)
-    {
-        if (x.i_ == nan || y.i_ == nan)
-            return false;
-        return x.i_ == y.i_;
-    }
-
-    friend bool operator!=(saturate x, saturate y) {return !(x == y);}
-
-    friend bool operator<(saturate x, saturate y)
-    {
-        if (x.i_ == nan || y.i_ == nan)
-            return false;
-        return x.i_ < y.i_;
-    }
-
-    friend bool operator<=(saturate x, saturate y)
-    {
-        if (x.i_ == nan || y.i_ == nan)
-            return false;
-        return x.i_ <= y.i_;
-    }
-
-    friend bool operator>(saturate x, saturate y)
-    {
-        if (x.i_ == nan || y.i_ == nan)
-            return false;
-        return x.i_ > y.i_;
-    }
-
-    friend bool operator>=(saturate x, saturate y)
-    {
-        if (x.i_ == nan || y.i_ == nan)
-            return false;
-        return x.i_ >= y.i_;
-    }
-
-    friend std::ostream& operator<<(std::ostream& os, saturate s)
-    {
-        switch (s.i_)
-        {
-        case pos_inf:
-            return os << "inf";
-        case nan:
-            return os << "nan";
-        case neg_inf:
-            return os << "-inf";
-        };
-        return os << s.i_;
-    }
-};
-
-template <class I>
-saturate<I>::operator int_type() const
-{
-    switch (i_)
-    {
-    case nan:
-    case neg_inf:
-    case pos_inf:
-        throw std::out_of_range("saturate special value can not convert to int_type");
-    }
-    return i_;
-}
-
-template <class I>
-saturate<I>&
-saturate<I>::operator+=(saturate x)
-{
-    switch (i_)
-    {
-    case pos_inf:
-        switch (x.i_)
-        {
-        case neg_inf:
-        case nan:
-            i_ = nan;
-        }
-        return *this;
-    case nan:
-        return *this;
-    case neg_inf:
-        switch (x.i_)
-        {
-        case pos_inf:
-        case nan:
-            i_ = nan;
-        }
-        return *this;
-    }
-    switch (x.i_)
-    {
-    case pos_inf:
-    case neg_inf:
-    case nan:
-        i_ = x.i_;
-        return *this;
-    }
-    if (x.i_ >= 0)
-    {
-        if (i_ < pos_inf - x.i_)
-            i_ += x.i_;
-        else
-            i_ = pos_inf;
-        return *this;
-    }
-    if (i_ > neg_inf - x.i_)
-        i_ += x.i_;
-    else
-        i_ = neg_inf;
-    return *this;
-}
-
-template <class I>
-saturate<I>&
-saturate<I>::operator*=(saturate x)
-{
-    switch (i_)
-    {
-    case 0:
-        switch (x.i_)
-        {
-        case pos_inf:
-        case neg_inf:
-        case nan:
-            i_ = nan;
-        }
-        return *this;
-    case pos_inf:
-        switch (x.i_)
-        {
-        case nan:
-        case 0:
-            i_ = nan;
-            return *this;
-        }
-        if (x.i_ < 0)
-            i_ = neg_inf;
-        return *this;
-    case nan:
-        return *this;
-    case neg_inf:
-        switch (x.i_)
-        {
-        case nan:
-        case 0:
-            i_ = nan;
-            return *this;
-        }
-        if (x.i_ < 0)
-            i_ = pos_inf;
-        return *this;
-    }
-    switch (x.i_)
-    {
-    case 0:
-        i_ = 0;
-        return *this;
-    case nan:
-        i_ = nan;
-        return *this;
-    case pos_inf:
-        if (i_ < 0)
-            i_ = neg_inf;
-        else
-            i_ = pos_inf;
-        return *this;
-    case neg_inf:
-        if (i_ < 0)
-            i_ = pos_inf;
-        else
-            i_ = neg_inf;
-        return *this;
-    }
-    int s = (i_ < 0 ? -1 : 1) * (x.i_ < 0 ? -1 : 1);
-    i_ = i_ < 0 ? -i_ : i_;
-    int_type x_i_ = x.i_ < 0 ? -x.i_ : x.i_;
-    if (i_ <= pos_inf / x_i_)
-        i_ *= x_i_;
-    else
-        i_ = pos_inf;
-    i_ *= s;
-    return *this;
-}
-
-template <class I>
-saturate<I>&
-saturate<I>::operator/=(saturate x)
-{
-    switch (x.i_)
-    {
-    case pos_inf:
-    case neg_inf:
-        switch (i_)
-        {
-        case pos_inf:
-        case neg_inf:
-        case nan:
-            i_ = nan;
-            break;
-        default:
-            i_ = 0;
-            break;
-        }
-        return *this;
-    case nan:
-        i_ = nan;
-        return *this;
-    case 0:
-        switch (i_)
-        {
-        case pos_inf:
-        case neg_inf:
-        case nan:
-            return *this;
-        case 0:
-            i_ = nan;
-            return *this;
-        }
-        if (i_ > 0)
-            i_ = pos_inf;
-        else
-            i_ = neg_inf;
-        return *this;
-    }
-    switch (i_)
-    {
-    case 0:
-    case nan:
-        return *this;
-    case pos_inf:
-    case neg_inf:
-        if (x.i_ < 0)
-            i_ = -i_;
-        return *this;
-    }
-    i_ /= x.i_;
-    return *this;
-}
-
-template <class I>
-saturate<I>&
-saturate<I>::operator%=(saturate x)
-{
-//    *this -= *this / x * x;  // definition
-    switch (x.i_)
-    {
-    case nan:
-    case neg_inf:
-    case 0:
-    case pos_inf:
-        i_ = nan;
-        return *this;
-    }
-    switch (i_)
-    {
-    case neg_inf:
-    case pos_inf:
-        i_ = nan;
-    case nan:
-        return *this;
-    }
-    i_ %= x.i_;
-    return *this;
-}
-
-// Demo overflow-safe integral durations ranging from picoseconds resolution to millennium resolution
-typedef boost::chrono::duration<saturate<long long>, boost::pico                 > picoseconds;
-typedef boost::chrono::duration<saturate<long long>, boost::nano                 > nanoseconds;
-typedef boost::chrono::duration<saturate<long long>, boost::micro                > microseconds;
-typedef boost::chrono::duration<saturate<long long>, boost::milli                > milliseconds;
-typedef boost::chrono::duration<saturate<long long>                            > seconds;
-typedef boost::chrono::duration<saturate<long long>, boost::ratio<         60LL> > minutes;
-typedef boost::chrono::duration<saturate<long long>, boost::ratio<       3600LL> > hours;
-typedef boost::chrono::duration<saturate<long long>, boost::ratio<      86400LL> > days;
-typedef boost::chrono::duration<saturate<long long>, boost::ratio<   31556952LL> > years;
-typedef boost::chrono::duration<saturate<long long>, boost::ratio<31556952000LL> > millennium;
-
-}  // User2
-
-// Demonstrate custom promotion rules (needed only if there are no implicit conversions)
-namespace User2 { namespace detail {
-
-template <class T1, class T2, bool = boost::is_integral<T1>::value>
-struct promote_helper;
-
-template <class T1, class T2>
-struct promote_helper<T1, saturate<T2>, true>  // integral
-{
-    typedef typename boost::common_type<T1, T2>::type rep;
-    typedef User2::saturate<rep> type;
-};
-
-template <class T1, class T2>
-struct promote_helper<T1, saturate<T2>, false>  // floating
-{
-    typedef T1 type;
-};
-
-} }
-
-namespace boost
-{
-
-template <class T1, class T2>
-struct common_type<User2::saturate<T1>, User2::saturate<T2> >
-{
-    typedef typename common_type<T1, T2>::type rep;
-    typedef User2::saturate<rep> type;
-};
-
-template <class T1, class T2>
-struct common_type<T1, User2::saturate<T2> >
-    : User2::detail::promote_helper<T1, User2::saturate<T2> > {};
-
-template <class T1, class T2>
-struct common_type<User2::saturate<T1>, T2>
-    : User2::detail::promote_helper<T2, User2::saturate<T1> > {};
-
-
-// Demonstrate specialization of duration_values:
-
-namespace chrono {
-
-template <class I>
-struct duration_values<User2::saturate<I> >
-{
-    typedef User2::saturate<I> Rep;
-public:
-    static Rep zero() {return Rep(0);}
-    static Rep max BOOST_PREVENT_MACRO_SUBSTITUTION ()  {return Rep(Rep::pos_inf-1);}
-    static Rep min BOOST_PREVENT_MACRO_SUBSTITUTION ()  {return -(max)();}
-};
-
-}  // namespace chrono
-
-}  // namespace boost
-
-
-void testUser2()
-{
-    std::cout << "*************\n";
-    std::cout << "* testUser2 *\n";
-    std::cout << "*************\n";
-    using namespace User2;
-    typedef seconds::rep sat;
-    years yr(sat(100));
-    std::cout << "100 years expressed as years = " << yr.count() << '\n';
-    nanoseconds ns = yr;
-    std::cout << "100 years expressed as nanoseconds = " << ns.count() << '\n';
-    ns += yr;
-    std::cout << "200 years expressed as nanoseconds = " << ns.count() << '\n';
-    ns += yr;
-    std::cout << "300 years expressed as nanoseconds = " << ns.count() << '\n';
-//    yr = ns;  // does not compile
-    std::cout << "yr = ns;  // does not compile\n";
-//    picoseconds ps1 = yr;  // does not compile, compile-time overflow in ratio arithmetic
-    std::cout << "ps = yr;  // does not compile\n";
-    ns = yr;
-    picoseconds ps = ns;
-    std::cout << "100 years expressed as picoseconds = " << ps.count() << '\n';
-    ps = ns / sat(1000);
-    std::cout << "0.1 years expressed as picoseconds = " << ps.count() << '\n';
-    yr = years(sat(-200000000));
-    std::cout << "200 million years ago encoded in years: " << yr.count() << '\n';
-    days d = boost::chrono::duration_cast<days>(yr);
-    std::cout << "200 million years ago encoded in days: " << d.count() << '\n';
-    millennium c = boost::chrono::duration_cast<millennium>(yr);
-    std::cout << "200 million years ago encoded in millennium: " << c.count() << '\n';
-    std::cout << "Demonstrate \"uninitialized protection\" behavior:\n";
-    seconds sec;
-    for (++sec; sec < seconds(sat(10)); ++sec)
-        ;
-    std::cout << sec.count() << '\n';
-    std::cout << "\n";
-}
-
-void testStdUser()
-{
-    std::cout << "***************\n";
-    std::cout << "* testStdUser *\n";
-    std::cout << "***************\n";
-    using namespace boost::chrono;
-    hours hr = hours(100);
-    std::cout << "100 hours expressed as hours = " << hr.count() << '\n';
-    nanoseconds ns = hr;
-    std::cout << "100 hours expressed as nanoseconds = " << ns.count() << '\n';
-    ns += hr;
-    std::cout << "200 hours expressed as nanoseconds = " << ns.count() << '\n';
-    ns += hr;
-    std::cout << "300 hours expressed as nanoseconds = " << ns.count() << '\n';
-//    hr = ns;  // does not compile
-    std::cout << "hr = ns;  // does not compile\n";
-//    hr * ns;  // does not compile
-    std::cout << "hr * ns;  // does not compile\n";
-    duration<double> fs(2.5);
-    std::cout << "duration<double> has count() = " << fs.count() << '\n';
-//    seconds sec = fs;  // does not compile
-    std::cout << "seconds sec = duration<double> won't compile\n";
-    seconds sec = duration_cast<seconds>(fs);
-    std::cout << "seconds has count() = " << sec.count() << '\n';
-    std::cout << "\n";
-}
-
-//  timeval clock demo
-//     Demonstrate the use of a timeval-like struct to be used as the representation
-//     type for both duraiton and time_point.
-
-namespace timeval_demo
-{
-
-class xtime {
-private:
-    long tv_sec;
-    long tv_usec;
-
-    void fixup() {
-        if (tv_usec < 0) {
-            tv_usec += 1000000;
-            --tv_sec;
-        }
-    }
-
-public:
-
-    explicit xtime(long sec, long usec) {
-        tv_sec = sec;
-        tv_usec = usec;
-        if (tv_usec < 0 || tv_usec >= 1000000) {
-            tv_sec += tv_usec / 1000000;
-            tv_usec %= 1000000;
-            fixup();
-        }
-    }
-
-    explicit xtime(long long usec)
-    {
-        tv_usec = static_cast<long>(usec % 1000000);
-        tv_sec  = static_cast<long>(usec / 1000000);
-        fixup();
-    }
-    
-    // explicit
-    operator long long() const {return static_cast<long long>(tv_sec) * 1000000 + tv_usec;}
-
-    xtime& operator += (xtime rhs) {
-        tv_sec += rhs.tv_sec;
-        tv_usec += rhs.tv_usec;
-        if (tv_usec >= 1000000) {
-            tv_usec -= 1000000;
-            ++tv_sec;
-        }
-        return *this;
-    }
-
-    xtime& operator -= (xtime rhs) {
-        tv_sec -= rhs.tv_sec;
-        tv_usec -= rhs.tv_usec;
-        fixup();
-        return *this;
-    }
-
-    xtime& operator %= (xtime rhs) {
-        long long t = tv_sec * 1000000 + tv_usec;
-        long long r = rhs.tv_sec * 1000000 + rhs.tv_usec;
-        t %= r;
-        tv_sec = static_cast<long>(t / 1000000);
-        tv_usec = static_cast<long>(t % 1000000);
-        fixup();
-        return *this;
-    }
-
-    friend xtime operator+(xtime x, xtime y) {return x += y;}
-    friend xtime operator-(xtime x, xtime y) {return x -= y;}
-    friend xtime operator%(xtime x, xtime y) {return x %= y;}
-
-    friend bool operator==(xtime x, xtime y)
-        { return (x.tv_sec == y.tv_sec && x.tv_usec == y.tv_usec); }
-
-    friend bool operator<(xtime x, xtime y) {
-        if (x.tv_sec == y.tv_sec)
-            return (x.tv_usec < y.tv_usec);
-        return (x.tv_sec < y.tv_sec);
-    }
-
-    friend bool operator!=(xtime x, xtime y) { return !(x == y); }
-    friend bool operator> (xtime x, xtime y) { return y < x; }
-    friend bool operator<=(xtime x, xtime y) { return !(y < x); }
-    friend bool operator>=(xtime x, xtime y) { return !(x < y); }
-
-    friend std::ostream& operator<<(std::ostream& os, xtime x)
-        {return os << '{' << x.tv_sec << ',' << x.tv_usec << '}';}
-};
-
-class xtime_clock
-{
-public:
-    typedef xtime                                  rep;
-    typedef boost::micro                           period;
-    typedef boost::chrono::duration<rep, period>   duration;
-    typedef boost::chrono::time_point<xtime_clock> time_point;
-
-    static time_point now();
-};
-
-xtime_clock::time_point
-xtime_clock::now()
-{
-#if defined(BOOST_CHRONO_WINDOWS_API)
-    time_point t(duration(xtime(0)));
-    gettimeofday((timeval*)&t, 0);
-    return t;
-
-#elif defined(BOOST_CHRONO_MAC_API)
-
-    time_point t(duration(xtime(0)));
-    gettimeofday((timeval*)&t, 0);
-    return t;
-
-#elif defined(BOOST_CHRONO_POSIX_API)
-    timespec ts;
-    ::clock_gettime( CLOCK_REALTIME, &ts );
-
-    xtime xt( ts.tv_sec, ts.tv_nsec/1000);
-    return time_point(duration(xt));
-      
-#endif  // POSIX
-}
-
-void test_xtime_clock()
-{
-    using namespace boost::chrono;
-    std::cout << "timeval_demo system clock test\n";
-    std::cout << "sizeof xtime_clock::time_point = " << sizeof(xtime_clock::time_point) << '\n';
-    std::cout << "sizeof xtime_clock::duration = " << sizeof(xtime_clock::duration) << '\n';
-    std::cout << "sizeof xtime_clock::rep = " << sizeof(xtime_clock::rep) << '\n';
-    xtime_clock::duration delay(milliseconds(5));
-    xtime_clock::time_point start = xtime_clock::now();
-    while (xtime_clock::now() - start <= delay)
-    {
-    }
-    xtime_clock::time_point stop = xtime_clock::now();
-    xtime_clock::duration elapsed = stop - start;
-    std::cout << "paused " << nanoseconds(elapsed).count() << " nanoseconds\n";
-}
-
-}  // timeval_demo
-
-// Handle duration with resolution not known until run time
-
-namespace runtime_resolution
-{
-
-class duration
-{
-public:
-    typedef long long rep;
-private:
-    rep rep_;
-
-    static const double ticks_per_nanosecond;
-
-public:
-    typedef boost::chrono::duration<double, boost::nano> tonanosec;
-
-    duration() {} // = default;
-    explicit duration(const rep& r) : rep_(r) {}
-
-    // conversions
-    explicit duration(const tonanosec& d)
-            : rep_(static_cast<rep>(d.count() * ticks_per_nanosecond)) {}
-
-    // explicit
-       operator tonanosec() const {return tonanosec(rep_/ticks_per_nanosecond);}
-
-    // observer
-
-    rep count() const {return rep_;}
-
-    // arithmetic
-
-    duration& operator+=(const duration& d) {rep_ += d.rep_; return *this;}
-    duration& operator-=(const duration& d) {rep_ += d.rep_; return *this;}
-    duration& operator*=(rep rhs)           {rep_ *= rhs; return *this;}
-    duration& operator/=(rep rhs)           {rep_ /= rhs; return *this;}
-
-    duration  operator+() const {return *this;}
-    duration  operator-() const {return duration(-rep_);}
-    duration& operator++()      {++rep_; return *this;}
-    duration  operator++(int)   {return duration(rep_++);}
-    duration& operator--()      {--rep_; return *this;}
-    duration  operator--(int)   {return duration(rep_--);}
-
-    friend duration operator+(duration x, duration y) {return x += y;}
-    friend duration operator-(duration x, duration y) {return x -= y;}
-    friend duration operator*(duration x, rep y)      {return x *= y;}
-    friend duration operator*(rep x, duration y)      {return y *= x;}
-    friend duration operator/(duration x, rep y)      {return x /= y;}
-
-    friend bool operator==(duration x, duration y) {return x.rep_ == y.rep_;}
-    friend bool operator!=(duration x, duration y) {return !(x == y);}
-    friend bool operator< (duration x, duration y) {return x.rep_ < y.rep_;}
-    friend bool operator<=(duration x, duration y) {return !(y < x);}
-    friend bool operator> (duration x, duration y) {return y < x;}
-    friend bool operator>=(duration x, duration y) {return !(x < y);}
-};
-
-static
-double
-init_duration()
-{
-    //mach_timebase_info_data_t MachInfo;
-    //mach_timebase_info(&MachInfo);
-    //return static_cast<double>(MachInfo.denom) / MachInfo.numer;
-    return static_cast<double>(1) / 1000; // Windows FILETIME is 1 per microsec 
-}
-
-const double duration::ticks_per_nanosecond = init_duration();
-
-class clock;
-
-class time_point
-{
-public:
-    typedef runtime_resolution::clock clock;
-    typedef long long rep;
-private:
-    rep rep_;
-
-
-    rep count() const {return rep_;}
-public:
-
-    time_point() : rep_(0) {}
-    explicit time_point(const duration& d)
-        : rep_(d.count()) {}
-
-    // arithmetic
-
-    time_point& operator+=(const duration& d) {rep_ += d.count(); return *this;}
-    time_point& operator-=(const duration& d) {rep_ -= d.count(); return *this;}
-
-    friend time_point operator+(time_point x, duration y) {return x += y;}
-    friend time_point operator+(duration x, time_point y) {return y += x;}
-    friend time_point operator-(time_point x, duration y) {return x -= y;}
-    friend duration operator-(time_point x, time_point y) {return duration(x.rep_ - y.rep_);}
-};
-
-class clock
-{
-public:
-    typedef duration::rep rep;
-    typedef runtime_resolution::duration duration;
-    typedef runtime_resolution::time_point time_point;
-
-    static time_point now()
-    {
-        
-#if defined(BOOST_CHRONO_WINDOWS_API)
-        timeval tv;
-        gettimeofday( &tv, 0 );
-        return time_point(duration((static_cast<rep>(tv.tv_sec)<<32) | tv.tv_usec));
-
-#elif defined(BOOST_CHRONO_MAC_API)
-
-        timeval tv;
-        gettimeofday( &tv, 0 );
-        return time_point(duration((static_cast<rep>(tv.tv_sec)<<32) | tv.tv_usec));
-
-#elif defined(BOOST_CHRONO_POSIX_API)
-        timespec ts;
-        ::clock_gettime( CLOCK_REALTIME, &ts );
-        return time_point(duration((static_cast<rep>(ts.tv_sec)<<32) | ts.tv_nsec/1000));
-      
-#endif  // POSIX
-
-    }
-};
-
-void test()
-{
-    using namespace boost::chrono;
-    std::cout << "runtime_resolution test\n";
-    clock::duration delay(boost::chrono::milliseconds(5));
-    clock::time_point start = clock::now();
-    while (clock::now() - start <= delay)
-      ;
-    clock::time_point stop = clock::now();
-    clock::duration elapsed = stop - start;
-    std::cout << "paused " << nanoseconds(duration_cast<nanoseconds>(duration::tonanosec(elapsed))).count()
-                           << " nanoseconds\n";
-}
-
-}  // runtime_resolution
-
-
 int main()
 {
-    runtime_resolution::test();
+    basic_examples();
     return 0;
 }
 
Modified: sandbox/chrono/libs/chrono/src/posix/process_clock.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/src/posix/process_clock.cpp	(original)
+++ sandbox/chrono/libs/chrono/src/posix/process_clock.cpp	2009-12-11 17:40:12 EST (Fri, 11 Dec 2009)
@@ -52,7 +52,7 @@
 
       tms tm;
       clock_t c = ::times( &tm );
-      if ( c == -1 ) // error
+      if ( c == clock_t(-1) ) // error
       {
         assert( 0 && "error handling not implemented yet" );