|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r74785 - in branches/release: boost/chrono boost/chrono/detail boost/chrono/detail/inlined boost/chrono/detail/inlined/mac boost/chrono/detail/inlined/posix boost/chrono/detail/inlined/win libs/chrono/example libs/chrono/test libs/chrono/test/clock
From: vicente.botet_at_[hidden]
Date: 2011-10-07 18:04:14
Author: viboes
Date: 2011-10-07 18:04:11 EDT (Fri, 07 Oct 2011)
New Revision: 74785
URL: http://svn.boost.org/trac/boost/changeset/74785
Log:
Chrono: Merged #5976,5979,5978,5906,5907,5909,5946,5974
Added:
branches/release/boost/chrono/ceil.hpp (contents, props changed)
branches/release/boost/chrono/floor.hpp (contents, props changed)
branches/release/boost/chrono/round.hpp (contents, props changed)
branches/release/libs/chrono/example/rounding.cpp (contents, props changed)
Text files modified:
branches/release/boost/chrono/config.hpp | 32 ++
branches/release/boost/chrono/detail/inlined/mac/chrono.hpp | 17 -
branches/release/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp | 435 +++++++++++++++++++++++----------------
branches/release/boost/chrono/detail/inlined/posix/chrono.hpp | 20 -
branches/release/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp | 128 ++++++++++-
branches/release/boost/chrono/detail/inlined/posix/thread_clock.hpp | 8
branches/release/boost/chrono/detail/inlined/process_cpu_clocks.hpp | 3
branches/release/boost/chrono/detail/inlined/win/chrono.hpp | 20 -
branches/release/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp | 200 +++++++++++------
branches/release/boost/chrono/detail/inlined/win/thread_clock.hpp | 10
branches/release/boost/chrono/detail/scan_keyword.hpp | 2
branches/release/boost/chrono/duration.hpp | 66 +++---
branches/release/boost/chrono/process_cpu_clocks.hpp | 272 +++++++++++++++++-------
branches/release/boost/chrono/system_clocks.hpp | 12
branches/release/boost/chrono/thread_clock.hpp | 9
branches/release/boost/chrono/time_point.hpp | 25 +-
branches/release/libs/chrono/example/test_thread_clock.cpp | 3
branches/release/libs/chrono/test/Jamfile.v2 | 248 ++++++++++++++++------
branches/release/libs/chrono/test/clock/clock_pass.cpp | 2
19 files changed, 977 insertions(+), 535 deletions(-)
Added: branches/release/boost/chrono/ceil.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/chrono/ceil.hpp 2011-10-07 18:04:11 EDT (Fri, 07 Oct 2011)
@@ -0,0 +1,36 @@
+// boost/chrono/round.hpp ------------------------------------------------------------//
+
+// (C) Copyright Howard Hinnant
+// Copyright 2011 Vicente J. Botet Escriba
+
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/chrono for documentation.
+
+#ifndef BOOST_CHRONO_CEIL_HPP
+#define BOOST_CHRONO_CEIL_HPP
+
+#include <boost/chrono/duration.hpp>
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ /**
+ * rounds up
+ */
+ template <class To, class Rep, class Period>
+ To ceil(const duration<Rep, Period>& d)
+ {
+ To t = duration_cast<To>(d);
+ if (t < d)
+ ++t;
+ return t;
+ }
+
+ } // namespace chrono
+} // namespace boost
+
+#endif
Modified: branches/release/boost/chrono/config.hpp
==============================================================================
--- branches/release/boost/chrono/config.hpp (original)
+++ branches/release/boost/chrono/config.hpp 2011-10-07 18:04:11 EDT (Fri, 07 Oct 2011)
@@ -37,19 +37,30 @@
# elif !defined( BOOST_CHRONO_WINDOWS_API ) && !defined( BOOST_CHRONO_MAC_API ) && !defined( BOOST_CHRONO_POSIX_API )
# if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32))
# define BOOST_CHRONO_WINDOWS_API
-# define BOOST_CHRONO_HAS_CLOCK_STEADY
-# define BOOST_CHRONO_HAS_THREAD_CLOCK
-# define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true
# elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
# define BOOST_CHRONO_MAC_API
-# define BOOST_CHRONO_HAS_CLOCK_STEADY
-# define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true
# else
# define BOOST_CHRONO_POSIX_API
# endif
# endif
+# if defined( BOOST_CHRONO_WINDOWS_API )
+# ifndef UNDER_CE
+# define BOOST_CHRONO_HAS_PROCESS_CLOCKS
+# endif
+# define BOOST_CHRONO_HAS_CLOCK_STEADY
+# define BOOST_CHRONO_HAS_THREAD_CLOCK
+# define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true
+# endif
+
+# if defined( BOOST_CHRONO_MAC_API )
+# define BOOST_CHRONO_HAS_PROCESS_CLOCKS
+# define BOOST_CHRONO_HAS_CLOCK_STEADY
+# define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true
+# endif
+
# if defined( BOOST_CHRONO_POSIX_API )
+# define BOOST_CHRONO_HAS_PROCESS_CLOCKS
# include <time.h> //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME
# if defined(CLOCK_REALTIME)
# if defined(CLOCK_MONOTONIC)
@@ -66,6 +77,10 @@
# define BOOST_CHRONO_HAS_THREAD_CLOCK
# define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true
# endif
+# if defined(sun) || defined(__sun)
+# undef BOOST_CHRONO_HAS_THREAD_CLOCK
+# undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY
+# endif
# endif
#if defined(BOOST_CHRONO_THREAD_DISABLED) && defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
@@ -73,6 +88,7 @@
#undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY
#endif
+
// unicode support ------------------------------//
#if defined(BOOST_NO_UNICODE_LITERALS) || defined(BOOST_NO_CHAR16_T) || defined(BOOST_NO_CHAR32_T)
@@ -93,6 +109,12 @@
#define BOOST_CHRONO_CONST_REF
#endif
+#if defined(BOOST_NO_NOEXCEPT)
+#define BOOST_CHRONO_NOEXCEPT
+#else
+#define BOOST_CHRONO_NOEXCEPT noexcept
+#endif
+
#define BOOST_CHRONO_STATIC_CONSTEXPR static BOOST_CHRONO_CONSTEXPR_OR_CONST
Modified: branches/release/boost/chrono/detail/inlined/mac/chrono.hpp
==============================================================================
--- branches/release/boost/chrono/detail/inlined/mac/chrono.hpp (original)
+++ branches/release/boost/chrono/detail/inlined/mac/chrono.hpp 2011-10-07 18:04:11 EDT (Fri, 07 Oct 2011)
@@ -26,7 +26,7 @@
// which has a field for seconds and a field for microseconds.
// Fill in the timeval and then convert that to the time_point
system_clock::time_point
-system_clock::now()
+system_clock::now() BOOST_CHRONO_NOEXCEPT
{
timeval tv;
gettimeofday(&tv, 0);
@@ -49,14 +49,14 @@
// an integral count of seconds since New Years 1970 (same epoch as timeval).
// Just get the duration out of the time_point and truncate it to seconds.
time_t
-system_clock::to_time_t(const time_point& t)
+system_clock::to_time_t(const time_point& t) BOOST_CHRONO_NOEXCEPT
{
return time_t(duration_cast<seconds>(t.time_since_epoch()).count());
}
// Just turn the time_t into a count of seconds and construct a time_point with it.
system_clock::time_point
-system_clock::from_time_t(time_t t)
+system_clock::from_time_t(time_t t) BOOST_CHRONO_NOEXCEPT
{
return system_clock::time_point(seconds(t));
}
@@ -114,8 +114,7 @@
static const double factor = chrono_detail::compute_steady_factor(err);
if (err != 0)
{
- boost::throw_exception(
- system::system_error( err, BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::steady_clock" ));
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
}
return static_cast<steady_clock::rep>(mach_absolute_time() * factor);
}
@@ -191,17 +190,13 @@
}
steady_clock::time_point
-steady_clock::now()
+steady_clock::now() BOOST_CHRONO_NOEXCEPT
{
static kern_return_t err;
static chrono_detail::FP fp = chrono_detail::init_steady_clock(err);
if ( err != 0 )
{
- boost::throw_exception(
- system::system_error(
- err,
- BOOST_CHRONO_SYSTEM_CATEGORY,
- "chrono::steady_clock" ));
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
}
return time_point(duration(fp()));
}
Modified: branches/release/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp
==============================================================================
--- branches/release/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp (original)
+++ branches/release/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp 2011-10-07 18:04:11 EDT (Fri, 07 Oct 2011)
@@ -18,234 +18,305 @@
#include <sys/times.h> //for times
# include <unistd.h>
-
-namespace boost { namespace chrono {
-namespace chrono_detail {
-
- inline long tick_factor() // multiplier to convert ticks
- // to nanoseconds; -1 if unknown
+namespace boost
+{
+ namespace chrono
+ {
+ namespace chrono_detail
{
+
+ inline long tick_factor() // multiplier to convert ticks
+ // to nanoseconds; -1 if unknown
+ {
static long factor = 0;
- if ( !factor )
+ if (!factor)
{
- if ( (factor = ::sysconf( _SC_CLK_TCK )) <= 0 )
- factor = -1;
- else
- {
- BOOST_ASSERT( factor <= 1000000l ); // doesn't handle large ticks
- factor = 1000000l / factor; // compute factor
- if ( !factor ) factor = -1;
- }
+ if ((factor = ::sysconf(_SC_CLK_TCK)) <= 0)
+ factor = -1;
+ else
+ {
+ BOOST_ASSERT(factor <= 1000000000l); // doesn't handle large ticks
+ factor = 1000000000l / factor; // compute factor
+ if (!factor)
+ factor = -1;
+ }
}
return factor;
+ }
}
-}
-process_real_cpu_clock::time_point process_real_cpu_clock::now(
- system::error_code & ec)
-{
-
- tms tm;
- clock_t c = ::times( &tm );
- if ( c == clock_t(-1) ) // error
+
+ process_real_cpu_clock::time_point process_real_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
{
+#if 0
+ tms tm;
+ clock_t c = ::times(&tm);
+ if (c == clock_t(-1)) // error
+ {
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
+ } else
+ {
+ long factor = chrono_detail::tick_factor();
+ if (factor != -1)
+ {
+ return time_point(nanoseconds(c * factor));
+ } else
+ {
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
+ }
+ }
+ return time_point();
+#else
+ clock_t c = ::clock();
+ if (c == clock_t(-1)) // error
+ {
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
+ }
+ return time_point(
+ duration(c*(1000000000l/CLOCKS_PER_SEC))
+ );
+#endif
+ }
+
+ process_real_cpu_clock::time_point process_real_cpu_clock::now(system::error_code & ec)
+ {
+
+#if 0
+ tms tm;
+ clock_t c = ::times(&tm);
+ if (c == clock_t(-1)) // error
+ {
if (BOOST_CHRONO_IS_THROWS(ec))
{
- boost::throw_exception(
- system::system_error(
- errno,
- BOOST_CHRONO_SYSTEM_CATEGORY,
- "chrono::process_real_cpu_clock" ));
- }
- else
+ boost::throw_exception(system::system_error(errno, BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_real_cpu_clock"));
+ } else
{
- ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
+ ec.assign(errno, BOOST_CHRONO_SYSTEM_CATEGORY);
+ return time_point();
+ }
+ } else
+ {
+ long factor = chrono_detail::tick_factor();
+ if (factor != -1)
+ {
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ ec.clear();
+ }
+ return time_point(nanoseconds(c * factor));
+ } else
+ {
+ if (BOOST_CHRONO_IS_THROWS(ec))
+ {
+ boost::throw_exception(system::system_error(errno, BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_real_cpu_clock"));
+ } else
+ {
+ ec.assign(errno, BOOST_CHRONO_SYSTEM_CATEGORY);
return time_point();
+ }
}
- }
- else
- {
- if ( chrono_detail::tick_factor() != -1 )
+ }
+#else
+ clock_t c = ::clock();
+ if (c == clock_t(-1)) // error
+ {
+ if (BOOST_CHRONO_IS_THROWS(ec))
+ {
+ boost::throw_exception(system::system_error(errno, BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_real_cpu_clock"));
+ } else
{
- if (!BOOST_CHRONO_IS_THROWS(ec))
- {
- ec.clear();
- }
- return time_point(
- microseconds(c)*chrono_detail::tick_factor());
- }
- else
- {
- if (BOOST_CHRONO_IS_THROWS(ec))
- {
- boost::throw_exception(
- system::system_error(
- errno,
- BOOST_CHRONO_SYSTEM_CATEGORY,
- "chrono::process_real_cpu_clock" ));
- }
- else
- {
- ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
- return time_point();
- }
+ ec.assign(errno, BOOST_CHRONO_SYSTEM_CATEGORY);
+ return time_point();
}
+ }
+ return time_point(
+ duration(c*(1000000000l/CLOCKS_PER_SEC))
+ );
+
+#endif
+
}
-}
-process_user_cpu_clock::time_point process_user_cpu_clock::now(
- system::error_code & ec)
-{
- tms tm;
- clock_t c = ::times( &tm );
- if ( c == clock_t(-1) ) // error
+ process_user_cpu_clock::time_point process_user_cpu_clock::now(system::error_code & ec)
{
+ tms tm;
+ clock_t c = ::times(&tm);
+ if (c == clock_t(-1)) // error
+ {
if (BOOST_CHRONO_IS_THROWS(ec))
{
- boost::throw_exception(
- system::system_error(
- errno,
- BOOST_CHRONO_SYSTEM_CATEGORY,
- "chrono::process_user_cpu_clock" ));
- }
- else
+ boost::throw_exception(system::system_error(errno, BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_user_cpu_clock"));
+ } else
{
- ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
+ ec.assign(errno, BOOST_CHRONO_SYSTEM_CATEGORY);
+ return time_point();
+ }
+ } else
+ {
+ long factor = chrono_detail::tick_factor();
+ if (factor != -1)
+ {
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ ec.clear();
+ }
+ return time_point(nanoseconds((tm.tms_utime + tm.tms_cutime) * factor));
+ } else
+ {
+ if (BOOST_CHRONO_IS_THROWS(ec))
+ {
+ boost::throw_exception(system::system_error(errno, BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_user_cpu_clock"));
+ } else
+ {
+ ec.assign(errno, BOOST_CHRONO_SYSTEM_CATEGORY);
return time_point();
+ }
}
+ }
}
- else
+
+ process_user_cpu_clock::time_point process_user_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
{
- if ( chrono_detail::tick_factor() != -1 )
+ tms tm;
+ clock_t c = ::times(&tm);
+ if (c == clock_t(-1)) // error
+ {
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
+ } else
+ {
+ long factor = chrono_detail::tick_factor();
+ if (factor != -1)
+ {
+ return time_point(nanoseconds((tm.tms_utime + tm.tms_cutime)
+ * factor));
+ } else
{
- if (!BOOST_CHRONO_IS_THROWS(ec))
- {
- ec.clear();
- }
- return time_point(
- microseconds(tm.tms_utime + tm.tms_cutime)*chrono_detail::tick_factor());
- }
- else
- {
- if (BOOST_CHRONO_IS_THROWS(ec))
- {
- boost::throw_exception(
- system::system_error(
- errno,
- BOOST_CHRONO_SYSTEM_CATEGORY,
- "chrono::process_user_cpu_clock" ));
- }
- else
- {
- ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
- return time_point();
- }
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
}
+ }
+ return time_point();
+ }
+ process_system_cpu_clock::time_point process_system_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
+ {
+ tms tm;
+ clock_t c = ::times(&tm);
+ if (c == clock_t(-1)) // error
+ {
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
+ } else
+ {
+ long factor = chrono_detail::tick_factor();
+ if (factor != -1)
+ {
+ return time_point(nanoseconds((tm.tms_stime + tm.tms_cstime)
+ * factor));
+ } else
+ {
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
+ }
+ }
+ return time_point();
}
-}
-process_system_cpu_clock::time_point process_system_cpu_clock::now(
- system::error_code & ec)
-{
- tms tm;
- clock_t c = ::times( &tm );
- if ( c == clock_t(-1) ) // error
+ process_system_cpu_clock::time_point process_system_cpu_clock::now(system::error_code & ec)
{
+ tms tm;
+ clock_t c = ::times(&tm);
+ if (c == clock_t(-1)) // error
+ {
if (BOOST_CHRONO_IS_THROWS(ec))
{
- boost::throw_exception(
- system::system_error(
- errno,
- BOOST_CHRONO_SYSTEM_CATEGORY,
- "chrono::process_system_cpu_clock" ));
- }
- else
+ boost::throw_exception(system::system_error(errno, BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_system_cpu_clock"));
+ } else
{
- ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
+ ec.assign(errno, BOOST_CHRONO_SYSTEM_CATEGORY);
+ return time_point();
+ }
+ } else
+ {
+ long factor = chrono_detail::tick_factor();
+ if (factor != -1)
+ {
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ ec.clear();
+ }
+ return time_point(nanoseconds((tm.tms_stime + tm.tms_cstime) * factor));
+ } else
+ {
+ if (BOOST_CHRONO_IS_THROWS(ec))
+ {
+ boost::throw_exception(system::system_error(errno, BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_system_cpu_clock"));
+ } else
+ {
+ ec.assign(errno, BOOST_CHRONO_SYSTEM_CATEGORY);
return time_point();
+ }
}
+ }
}
- else
+
+ process_cpu_clock::time_point process_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
{
- if ( chrono_detail::tick_factor() != -1 )
+ tms tm;
+ clock_t c = ::times(&tm);
+ if (c == clock_t(-1)) // error
+ {
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
+ } else
+ {
+ long factor = chrono_detail::tick_factor();
+ if (factor != -1)
+ {
+ time_point::rep
+ r(c * factor, (tm.tms_utime + tm.tms_cutime) * factor, (tm.tms_stime
+ + tm.tms_cstime) * factor);
+ return time_point(duration(r));
+ } else
{
- if (!BOOST_CHRONO_IS_THROWS(ec))
- {
- ec.clear();
- }
- return time_point(
- microseconds(tm.tms_stime + tm.tms_cstime)*chrono_detail::tick_factor());
- }
- else
- {
- if (BOOST_CHRONO_IS_THROWS(ec))
- {
- boost::throw_exception(
- system::system_error(
- errno,
- BOOST_CHRONO_SYSTEM_CATEGORY,
- "chrono::process_system_cpu_clock" ));
- }
- else
- {
- ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
- return time_point();
- }
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
}
+ }
+ return time_point();
}
-}
-process_cpu_clock::time_point process_cpu_clock::now(
- system::error_code & ec )
-{
-
-
- tms tm;
- clock_t c = ::times( &tm );
- if ( c == clock_t(-1) ) // error
+ process_cpu_clock::time_point process_cpu_clock::now(system::error_code & ec)
{
+
+ tms tm;
+ clock_t c = ::times(&tm);
+ if (c == clock_t(-1)) // error
+ {
if (BOOST_CHRONO_IS_THROWS(ec))
{
- boost::throw_exception(
- system::system_error(
- errno,
- BOOST_CHRONO_SYSTEM_CATEGORY,
- "chrono::process_clock" ));
- }
- else
+ boost::throw_exception(system::system_error(errno, BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_clock"));
+ } else
{
- ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
- return time_point();
+ ec.assign(errno, BOOST_CHRONO_SYSTEM_CATEGORY);
+ return time_point();
}
- }
- else
- {
- if ( chrono_detail::tick_factor() != -1 )
- {
- time_point::rep r(
- c*chrono_detail::tick_factor(),
- (tm.tms_utime + tm.tms_cutime)*chrono_detail::tick_factor(),
- (tm.tms_stime + tm.tms_cstime)*chrono_detail::tick_factor());
- return time_point(duration(r));
- }
- else
- {
- if (BOOST_CHRONO_IS_THROWS(ec))
- {
- boost::throw_exception(
- system::system_error(
- errno,
- BOOST_CHRONO_SYSTEM_CATEGORY,
- "chrono::process_clock" ));
- }
- else
- {
- ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
- return time_point();
- }
+ } else
+ {
+ long factor = chrono_detail::tick_factor();
+ if (factor != -1)
+ {
+ time_point::rep
+ r(c * factor, (tm.tms_utime + tm.tms_cutime) * factor, (tm.tms_stime
+ + tm.tms_cstime) * factor);
+ return time_point(duration(r));
+ } else
+ {
+ if (BOOST_CHRONO_IS_THROWS(ec))
+ {
+ boost::throw_exception(system::system_error(errno, BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::process_clock"));
+ } else
+ {
+ ec.assign(errno, BOOST_CHRONO_SYSTEM_CATEGORY);
+ return time_point();
+ }
}
+ }
+
}
-
-}
-}
+ }
}
Modified: branches/release/boost/chrono/detail/inlined/posix/chrono.hpp
==============================================================================
--- branches/release/boost/chrono/detail/inlined/posix/chrono.hpp (original)
+++ branches/release/boost/chrono/detail/inlined/posix/chrono.hpp 2011-10-07 18:04:11 EDT (Fri, 07 Oct 2011)
@@ -17,16 +17,12 @@
namespace chrono
{
- system_clock::time_point system_clock::now()
+ system_clock::time_point system_clock::now() BOOST_CHRONO_NOEXCEPT
{
timespec ts;
if ( ::clock_gettime( CLOCK_REALTIME, &ts ) )
{
- boost::throw_exception(
- system::system_error(
- errno,
- BOOST_CHRONO_SYSTEM_CATEGORY,
- "chrono::system_clock" ));
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
}
return time_point(duration(
@@ -61,28 +57,24 @@
static_cast<system_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
}
- std::time_t system_clock::to_time_t(const system_clock::time_point& t)
+ std::time_t system_clock::to_time_t(const system_clock::time_point& t) BOOST_CHRONO_NOEXCEPT
{
return static_cast<std::time_t>( t.time_since_epoch().count() / 1000000000 );
}
- system_clock::time_point system_clock::from_time_t(std::time_t t)
+ system_clock::time_point system_clock::from_time_t(std::time_t t) BOOST_CHRONO_NOEXCEPT
{
return time_point(duration(static_cast<system_clock::rep>(t) * 1000000000));
}
#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
- steady_clock::time_point steady_clock::now()
+ steady_clock::time_point steady_clock::now() BOOST_CHRONO_NOEXCEPT
{
timespec ts;
if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) )
{
- boost::throw_exception(
- system::system_error(
- errno,
- BOOST_CHRONO_SYSTEM_CATEGORY,
- "chrono::steady_clock" ));
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
}
return time_point(duration(
Modified: branches/release/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp
==============================================================================
--- branches/release/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp (original)
+++ branches/release/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp 2011-10-07 18:04:11 EDT (Fri, 07 Oct 2011)
@@ -14,8 +14,9 @@
#include <boost/chrono/process_cpu_clocks.hpp>
#include <boost/assert.hpp>
-# include <sys/times.h>
-# include <unistd.h>
+#include <sys/times.h>
+#include <unistd.h>
+#include <time.h> // for clock_gettime
namespace boost { namespace chrono {
@@ -40,6 +41,28 @@
}
}
+process_real_cpu_clock::time_point process_real_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
+{
+ tms tm;
+ clock_t c = ::times( &tm );
+ if ( c == clock_t(-1) ) // error
+ {
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
+ }
+ else
+ {
+ if ( chrono_detail::tick_factor() != -1 )
+ {
+ return time_point(
+ microseconds(c*chrono_detail::tick_factor()));
+ }
+ else
+ {
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
+ }
+ }
+ return time_point();
+}
process_real_cpu_clock::time_point process_real_cpu_clock::now(
system::error_code & ec)
{
@@ -71,7 +94,7 @@
ec.clear();
}
return time_point(
- microseconds(c)*chrono_detail::tick_factor());
+ microseconds(c*chrono_detail::tick_factor()));
}
else
{
@@ -92,6 +115,29 @@
}
}
+process_user_cpu_clock::time_point process_user_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
+{
+ tms tm;
+ clock_t c = ::times( &tm );
+ if ( c == clock_t(-1) ) // error
+ {
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
+ }
+ else
+ {
+ if ( chrono_detail::tick_factor() != -1 )
+ {
+ return time_point(
+ microseconds((tm.tms_utime + tm.tms_cutime)*chrono_detail::tick_factor()));
+ }
+ else
+ {
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
+ }
+ }
+ return time_point();
+}
+
process_user_cpu_clock::time_point process_user_cpu_clock::now(
system::error_code & ec)
{
@@ -122,7 +168,7 @@
ec.clear();
}
return time_point(
- microseconds(tm.tms_utime + tm.tms_cutime)*chrono_detail::tick_factor());
+ microseconds((tm.tms_utime + tm.tms_cutime)*chrono_detail::tick_factor()));
}
else
{
@@ -143,8 +189,31 @@
}
}
+process_system_cpu_clock::time_point process_system_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
+{
+ tms tm;
+ clock_t c = ::times( &tm );
+ if ( c == clock_t(-1) ) // error
+ {
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
+ return time_point();
+ }
+ else
+ {
+ if ( chrono_detail::tick_factor() != -1 )
+ {
+ return time_point(
+ microseconds((tm.tms_stime + tm.tms_cstime)*chrono_detail::tick_factor()));
+ }
+ else
+ {
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
+ }
+ }
+}
+
process_system_cpu_clock::time_point process_system_cpu_clock::now(
- system::error_code & ec)
+ system::error_code & ec)
{
tms tm;
clock_t c = ::times( &tm );
@@ -153,9 +222,9 @@
if (BOOST_CHRONO_IS_THROWS(ec))
{
boost::throw_exception(
- system::system_error(
- errno,
- BOOST_CHRONO_SYSTEM_CATEGORY,
+ system::system_error(
+ errno,
+ BOOST_CHRONO_SYSTEM_CATEGORY,
"chrono::process_system_cpu_clock" ));
}
else
@@ -168,21 +237,21 @@
{
if ( chrono_detail::tick_factor() != -1 )
{
- if (!BOOST_CHRONO_IS_THROWS(ec))
+ if (!BOOST_CHRONO_IS_THROWS(ec))
{
ec.clear();
}
return time_point(
- microseconds(tm.tms_stime + tm.tms_cstime)*chrono_detail::tick_factor());
+ microseconds((tm.tms_stime + tm.tms_cstime)*chrono_detail::tick_factor()));
}
else
{
if (BOOST_CHRONO_IS_THROWS(ec))
{
boost::throw_exception(
- system::system_error(
- errno,
- BOOST_CHRONO_SYSTEM_CATEGORY,
+ system::system_error(
+ errno,
+ BOOST_CHRONO_SYSTEM_CATEGORY,
"chrono::process_system_cpu_clock" ));
}
else
@@ -194,11 +263,34 @@
}
}
+process_cpu_clock::time_point process_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
+{
+ tms tm;
+ clock_t c = ::times( &tm );
+ if ( c == clock_t(-1) ) // error
+ {
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
+ }
+ else
+ {
+ if ( chrono_detail::tick_factor() != -1 )
+ {
+ time_point::rep r(
+ 1000*c*chrono_detail::tick_factor(),
+ 1000*(tm.tms_utime + tm.tms_cutime)*chrono_detail::tick_factor(),
+ 1000*(tm.tms_stime + tm.tms_cstime)*chrono_detail::tick_factor());
+ return time_point(duration(r));
+ }
+ else
+ {
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
+ }
+ }
+ return time_point();
+}
process_cpu_clock::time_point process_cpu_clock::now(
system::error_code & ec )
{
-
-
tms tm;
clock_t c = ::times( &tm );
if ( c == clock_t(-1) ) // error
@@ -222,9 +314,9 @@
if ( chrono_detail::tick_factor() != -1 )
{
time_point::rep r(
- c*chrono_detail::tick_factor(),
- (tm.tms_utime + tm.tms_cutime)*chrono_detail::tick_factor(),
- (tm.tms_stime + tm.tms_cstime)*chrono_detail::tick_factor());
+ 1000*c*chrono_detail::tick_factor(),
+ 1000*(tm.tms_utime + tm.tms_cutime)*chrono_detail::tick_factor(),
+ 1000*(tm.tms_stime + tm.tms_cstime)*chrono_detail::tick_factor());
return time_point(duration(r));
}
else
Modified: branches/release/boost/chrono/detail/inlined/posix/thread_clock.hpp
==============================================================================
--- branches/release/boost/chrono/detail/inlined/posix/thread_clock.hpp (original)
+++ branches/release/boost/chrono/detail/inlined/posix/thread_clock.hpp 2011-10-07 18:04:11 EDT (Fri, 07 Oct 2011)
@@ -19,7 +19,7 @@
namespace boost { namespace chrono {
- thread_clock::time_point thread_clock::now( )
+ thread_clock::time_point thread_clock::now( ) BOOST_CHRONO_NOEXCEPT
{
struct timespec ts;
#if defined CLOCK_THREAD_CPUTIME_ID
@@ -35,11 +35,7 @@
if ( ::clock_gettime( clock_id, &ts ) )
#endif
{
- boost::throw_exception(
- system::system_error(
- errno,
- BOOST_CHRONO_SYSTEM_CATEGORY,
- "chrono::thread_clock" ));
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
}
// transform to nanoseconds
Modified: branches/release/boost/chrono/detail/inlined/process_cpu_clocks.hpp
==============================================================================
--- branches/release/boost/chrono/detail/inlined/process_cpu_clocks.hpp (original)
+++ branches/release/boost/chrono/detail/inlined/process_cpu_clocks.hpp 2011-10-07 18:04:11 EDT (Fri, 07 Oct 2011)
@@ -13,6 +13,8 @@
#include <boost/chrono/config.hpp>
+#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS)
+
#include <boost/version.hpp>
#include <boost/chrono/process_cpu_clocks.hpp>
#include <boost/throw_exception.hpp>
@@ -76,5 +78,6 @@
} // namespace chrono
} // namespace boost
#endif
+#endif
#endif
Modified: branches/release/boost/chrono/detail/inlined/win/chrono.hpp
==============================================================================
--- branches/release/boost/chrono/detail/inlined/win/chrono.hpp (original)
+++ branches/release/boost/chrono/detail/inlined/win/chrono.hpp 2011-10-07 18:04:11 EDT (Fri, 07 Oct 2011)
@@ -23,7 +23,7 @@
namespace chrono_detail
{
- BOOST_CHRONO_INLINE double get_nanosecs_per_tic()
+ BOOST_CHRONO_INLINE double get_nanosecs_per_tic() BOOST_CHRONO_NOEXCEPT
{
boost::detail::win32::LARGE_INTEGER_ freq;
if ( !boost::detail::win32::QueryPerformanceFrequency( &freq ) )
@@ -33,7 +33,7 @@
}
- steady_clock::time_point steady_clock::now()
+ steady_clock::time_point steady_clock::now() BOOST_CHRONO_NOEXCEPT
{
static double nanosecs_per_tic = chrono_detail::get_nanosecs_per_tic();
@@ -41,15 +41,7 @@
if ( (nanosecs_per_tic <= 0.0L) ||
(!boost::detail::win32::QueryPerformanceCounter( &pcount )) )
{
- boost::detail::win32::DWORD_ cause =
- (nanosecs_per_tic <= 0.0L
- ? ERROR_NOT_SUPPORTED
- : boost::detail::win32::GetLastError());
- boost::throw_exception(
- system::system_error(
- cause,
- BOOST_CHRONO_SYSTEM_CATEGORY,
- "chrono::steady_clock" ));
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
}
return steady_clock::time_point(steady_clock::duration(
@@ -92,7 +84,7 @@
}
BOOST_CHRONO_INLINE
- system_clock::time_point system_clock::now()
+ system_clock::time_point system_clock::now() BOOST_CHRONO_NOEXCEPT
{
boost::detail::win32::FILETIME_ ft;
#if defined(UNDER_CE)
@@ -128,7 +120,7 @@
}
BOOST_CHRONO_INLINE
- std::time_t system_clock::to_time_t(const system_clock::time_point& t)
+ std::time_t system_clock::to_time_t(const system_clock::time_point& t) BOOST_CHRONO_NOEXCEPT
{
__int64 temp = t.time_since_epoch().count();
@@ -143,7 +135,7 @@
}
BOOST_CHRONO_INLINE
- system_clock::time_point system_clock::from_time_t(std::time_t t)
+ system_clock::time_point system_clock::from_time_t(std::time_t t) BOOST_CHRONO_NOEXCEPT
{
__int64 temp = t;
temp *= 10000000;
Modified: branches/release/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp
==============================================================================
--- branches/release/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp (original)
+++ branches/release/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp 2011-10-07 18:04:11 EDT (Fri, 07 Oct 2011)
@@ -13,9 +13,10 @@
#define BOOST_CHRONO_DETAIL_INLINED_WIN_PROCESS_CLOCK_HPP
#include <boost/chrono/config.hpp>
-#include <boost/chrono/system_clocks.hpp>
+//#include <boost/chrono/system_clocks.hpp>
#include <boost/chrono/process_cpu_clocks.hpp>
#include <cassert>
+#include <time.h>
#include <boost/detail/win/GetLastError.hpp>
#include <boost/detail/win/GetCurrentProcess.hpp>
@@ -26,65 +27,74 @@
namespace chrono
{
+process_real_cpu_clock::time_point process_real_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
+{
+ clock_t c = ::clock();
+ if ( c == clock_t(-1) ) // error
+ {
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
+ }
+ return time_point(
+ duration(c*(1000000000l/CLOCKS_PER_SEC))
+ );
+}
+
process_real_cpu_clock::time_point process_real_cpu_clock::now(
- system::error_code & ec)
+ system::error_code & ec)
+{
+ clock_t c = ::clock();
+ if ( c == clock_t(-1) ) // error
+ {
+ boost::throw_exception(
+ system::system_error(
+ errno,
+ BOOST_CHRONO_SYSTEM_CATEGORY,
+ "chrono::process_real_cpu_clock" ));
+ }
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ ec.clear();
+ }
+ return time_point(
+ duration(c*(1000000000l/CLOCKS_PER_SEC))
+ );
+}
+
+process_user_cpu_clock::time_point process_user_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
{
// note that Windows uses 100 nanosecond ticks for FILETIME
boost::detail::win32::FILETIME_ creation, exit, user_time, system_time;
- #ifdef UNDER_CE
- // Windows CE does not support GetProcessTimes
- assert( 0 && "GetProcessTimes not supported under Windows CE" );
- return time_point();
- #else
if ( boost::detail::win32::GetProcessTimes(
boost::detail::win32::GetCurrentProcess(), &creation, &exit,
&system_time, &user_time ) )
{
- if (!BOOST_CHRONO_IS_THROWS(ec))
- {
- ec.clear();
- }
- return time_point(steady_clock::now().time_since_epoch());
+ return time_point(duration(
+ ((static_cast<process_user_cpu_clock::rep>(user_time.dwHighDateTime) << 32)
+ | user_time.dwLowDateTime) * 100
+ ));
}
else
{
- boost::detail::win32::DWORD_ cause = boost::detail::win32::GetLastError();
- if (BOOST_CHRONO_IS_THROWS(ec))
- {
- boost::throw_exception(
- system::system_error(
- cause,
- BOOST_CHRONO_SYSTEM_CATEGORY,
- "chrono::process_real_cpu_clock" ));
- }
- else
- {
- ec.assign( cause, BOOST_CHRONO_SYSTEM_CATEGORY );
- return time_point();
- }
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
+ return time_point();
}
- #endif
}
+
process_user_cpu_clock::time_point process_user_cpu_clock::now(
- system::error_code & ec)
+ system::error_code & ec)
{
// note that Windows uses 100 nanosecond ticks for FILETIME
boost::detail::win32::FILETIME_ creation, exit, user_time, system_time;
- #ifdef UNDER_CE
- // Windows CE does not support GetProcessTimes
- assert( 0 && "GetProcessTimes not supported under Windows CE" );
- return time_point();
- #else
if ( boost::detail::win32::GetProcessTimes(
boost::detail::win32::GetCurrentProcess(), &creation, &exit,
&system_time, &user_time ) )
{
- if (!BOOST_CHRONO_IS_THROWS(ec))
+ if (!BOOST_CHRONO_IS_THROWS(ec))
{
ec.clear();
}
@@ -96,40 +106,58 @@
else
{
boost::detail::win32::DWORD_ cause = boost::detail::win32::GetLastError();
- if (BOOST_CHRONO_IS_THROWS(ec))
+ if (BOOST_CHRONO_IS_THROWS(ec))
{
boost::throw_exception(
- system::system_error(
- cause,
- BOOST_CHRONO_SYSTEM_CATEGORY,
+ system::system_error(
+ cause,
+ BOOST_CHRONO_SYSTEM_CATEGORY,
"chrono::process_user_cpu_clock" ));
- }
- else
+ }
+ else
{
ec.assign( cause, BOOST_CHRONO_SYSTEM_CATEGORY );
return time_point();
}
}
- #endif
}
+
+process_system_cpu_clock::time_point process_system_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
+{
+
+ // note that Windows uses 100 nanosecond ticks for FILETIME
+ boost::detail::win32::FILETIME_ creation, exit, user_time, system_time;
+
+ if ( boost::detail::win32::GetProcessTimes(
+ boost::detail::win32::GetCurrentProcess(), &creation, &exit,
+ &system_time, &user_time ) )
+ {
+ return time_point(duration(
+ ((static_cast<process_system_cpu_clock::rep>(system_time.dwHighDateTime) << 32)
+ | system_time.dwLowDateTime) * 100
+ ));
+ }
+ else
+ {
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
+ return time_point();
+ }
+
+}
+
process_system_cpu_clock::time_point process_system_cpu_clock::now(
- system::error_code & ec)
+ system::error_code & ec)
{
// note that Windows uses 100 nanosecond ticks for FILETIME
boost::detail::win32::FILETIME_ creation, exit, user_time, system_time;
- #ifdef UNDER_CE
- // Windows CE does not support GetProcessTimes
- assert( 0 && "GetProcessTimes not supported under Windows CE" );
- return time_point();
- #else
if ( boost::detail::win32::GetProcessTimes(
boost::detail::win32::GetCurrentProcess(), &creation, &exit,
&system_time, &user_time ) )
{
- if (!BOOST_CHRONO_IS_THROWS(ec))
+ if (!BOOST_CHRONO_IS_THROWS(ec))
{
ec.clear();
}
@@ -141,72 +169,94 @@
else
{
boost::detail::win32::DWORD_ cause = boost::detail::win32::GetLastError();
- if (BOOST_CHRONO_IS_THROWS(ec))
+ if (BOOST_CHRONO_IS_THROWS(ec))
{
boost::throw_exception(
- system::system_error(
- cause,
- BOOST_CHRONO_SYSTEM_CATEGORY,
+ system::system_error(
+ cause,
+ BOOST_CHRONO_SYSTEM_CATEGORY,
"chrono::process_system_cpu_clock" ));
- }
- else
+ }
+ else
{
ec.assign( cause, BOOST_CHRONO_SYSTEM_CATEGORY );
return time_point();
}
}
- #endif
-
+
+}
+process_cpu_clock::time_point process_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
+{
+
+ // note that Windows uses 100 nanosecond ticks for FILETIME
+ boost::detail::win32::FILETIME_ creation, exit, user_time, system_time;
+
+ if ( boost::detail::win32::GetProcessTimes(
+ boost::detail::win32::GetCurrentProcess(), &creation, &exit,
+ &system_time, &user_time ) )
+ {
+ time_point::rep r(process_real_cpu_clock::now().time_since_epoch().count()
+ ,
+ ((static_cast<process_user_cpu_clock::rep>(user_time.dwHighDateTime) << 32)
+ | user_time.dwLowDateTime
+ ) * 100,
+ ((static_cast<process_system_cpu_clock::rep>(system_time.dwHighDateTime) << 32)
+ | system_time.dwLowDateTime
+ ) * 100
+ );
+ return time_point(duration(r));
+ }
+ else
+ {
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
+ return time_point();
+ }
+
}
-process_cpu_clock::time_point process_cpu_clock::now(
- system::error_code & ec )
+
+process_cpu_clock::time_point process_cpu_clock::now(
+ system::error_code & ec )
{
// note that Windows uses 100 nanosecond ticks for FILETIME
boost::detail::win32::FILETIME_ creation, exit, user_time, system_time;
- #ifdef UNDER_CE
- // Windows CE does not support GetProcessTimes
- assert( 0 && "GetProcessTimes not supported under Windows CE" );
- return time_point();
- #else
if ( boost::detail::win32::GetProcessTimes(
boost::detail::win32::GetCurrentProcess(), &creation, &exit,
&system_time, &user_time ) )
{
- if (!BOOST_CHRONO_IS_THROWS(ec))
+ if (!BOOST_CHRONO_IS_THROWS(ec))
{
ec.clear();
}
- time_point::rep r(
- steady_clock::now().time_since_epoch().count(),
+ time_point::rep r(process_real_cpu_clock::now().time_since_epoch().count()
+ ,
((static_cast<process_user_cpu_clock::rep>(user_time.dwHighDateTime) << 32)
| user_time.dwLowDateTime
- ) * 100,
+ ) * 100,
((static_cast<process_system_cpu_clock::rep>(system_time.dwHighDateTime) << 32)
| system_time.dwLowDateTime
- ) * 100
+ ) * 100
);
return time_point(duration(r));
}
else
{
boost::detail::win32::DWORD_ cause = boost::detail::win32::GetLastError();
- if (BOOST_CHRONO_IS_THROWS(ec))
+ if (BOOST_CHRONO_IS_THROWS(ec))
{
boost::throw_exception(
- system::system_error(
- cause,
- BOOST_CHRONO_SYSTEM_CATEGORY,
+ system::system_error(
+ cause,
+ BOOST_CHRONO_SYSTEM_CATEGORY,
"chrono::process_cpu_clock" ));
- }
- else
+ }
+ else
{
ec.assign( cause, BOOST_CHRONO_SYSTEM_CATEGORY );
return time_point();
}
}
- #endif
}
} // namespace chrono
Modified: branches/release/boost/chrono/detail/inlined/win/thread_clock.hpp
==============================================================================
--- branches/release/boost/chrono/detail/inlined/win/thread_clock.hpp (original)
+++ branches/release/boost/chrono/detail/inlined/win/thread_clock.hpp 2011-10-07 18:04:11 EDT (Fri, 07 Oct 2011)
@@ -66,7 +66,7 @@
}
}
-thread_clock::time_point thread_clock::now( )
+thread_clock::time_point thread_clock::now() BOOST_CHRONO_NOEXCEPT
{
// note that Windows uses 100 nanosecond ticks for FILETIME
@@ -85,15 +85,11 @@
| system_time.dwLowDateTime) * 100 );
return time_point(system+user);
-
}
else
{
- boost::throw_exception(
- system::system_error(
- boost::detail::win32::GetLastError(),
- BOOST_CHRONO_SYSTEM_CATEGORY,
- "chrono::thread_clock" ));
+ BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
+ return time_point();
}
}
Modified: branches/release/boost/chrono/detail/scan_keyword.hpp
==============================================================================
--- branches/release/boost/chrono/detail/scan_keyword.hpp (original)
+++ branches/release/boost/chrono/detail/scan_keyword.hpp 2011-10-07 18:04:11 EDT (Fri, 07 Oct 2011)
@@ -30,7 +30,7 @@
namespace chrono {
namespace chrono_detail {
-inline void free_aux(void* ptr) { free(ptr); }
+inline void free_aux(void* ptr) { free(ptr); }
// scan_keyword
// Scans [b, e) until a match is found in the basic_strings range
Modified: branches/release/boost/chrono/duration.hpp
==============================================================================
--- branches/release/boost/chrono/duration.hpp (original)
+++ branches/release/boost/chrono/duration.hpp 2011-10-07 18:04:11 EDT (Fri, 07 Oct 2011)
@@ -255,7 +255,7 @@
}
};
- // When the denomenator of FromPeriod / ToPeriod is 1, then all we need to do is
+ // When the denominator of FromPeriod / ToPeriod is 1, then all we need to do is
// multiply by the numerator of FromPeriod / ToPeriod. The common_type of
// the two representations is used for the intermediate computation before
// static_cast'ing to the destination.
@@ -430,7 +430,7 @@
public:
BOOST_CHRONO_CONSTEXPR
- duration() : rep_(duration_values<rep>::zero()) { }
+ duration() : rep_(duration_values<rep>::zero()) { }
template <class Rep2>
BOOST_CHRONO_CONSTEXPR
explicit duration(const Rep2& r
@@ -446,8 +446,9 @@
>
>
>::type* = 0
- ) : rep_(r) { }
+ ) : rep_(r) { }
~duration() {} //= default;
+ BOOST_CHRONO_CONSTEXPR
duration(const duration& rhs) : rep_(rhs.rep_) {} // = default;
duration& operator=(const duration& rhs) // = default;
{
@@ -526,35 +527,33 @@
// Duration +
template <class Rep1, class Period1, class Rep2, class Period2>
- inline
+ inline BOOST_CHRONO_CONSTEXPR
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2> >::type
operator+(const duration<Rep1, Period1>& lhs,
const duration<Rep2, Period2>& rhs)
{
- typename common_type<duration<Rep1, Period1>,
- duration<Rep2, Period2> >::type result = lhs;
- result += rhs;
- return result;
+ typedef typename common_type<duration<Rep1, Period1>,
+ duration<Rep2, Period2> >::type CD;
+ return CD(CD(lhs).count()+CD(rhs).count());
}
// Duration -
template <class Rep1, class Period1, class Rep2, class Period2>
- inline
+ inline BOOST_CHRONO_CONSTEXPR
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2> >::type
operator-(const duration<Rep1, Period1>& lhs,
const duration<Rep2, Period2>& rhs)
{
- typename common_type<duration<Rep1, Period1>,
- duration<Rep2, Period2> >::type result = lhs;
- result -= rhs;
- return result;
+ typedef typename common_type<duration<Rep1, Period1>,
+ duration<Rep2, Period2> >::type CD;
+ return CD(CD(lhs).count()-CD(rhs).count());
}
// Duration *
template <class Rep1, class Period, class Rep2>
- inline
+ inline BOOST_CHRONO_CONSTEXPR
typename boost::enable_if <
mpl::and_ <
boost::is_convertible<Rep1, typename common_type<Rep1, Rep2>::type>,
@@ -564,14 +563,13 @@
>::type
operator*(const duration<Rep1, Period>& d, const Rep2& s)
{
- typedef typename common_type<Rep1, Rep2>::type CR;
- duration<CR, Period> r = d;
- r *= static_cast<CR>(s);
- return r;
+ typedef typename common_type<Rep1, Rep2>::type CR;
+ typedef duration<CR, Period> CD;
+ return CD(CD(d).count()*static_cast<CR>(s));
}
template <class Rep1, class Period, class Rep2>
- inline
+ inline BOOST_CHRONO_CONSTEXPR
typename boost::enable_if <
mpl::and_ <
boost::is_convertible<Rep1, typename common_type<Rep1, Rep2>::type>,
@@ -587,7 +585,7 @@
// Duration /
template <class Rep1, class Period, class Rep2>
- inline
+ inline BOOST_CHRONO_CONSTEXPR
typename boost::disable_if <boost::chrono::detail::is_duration<Rep2>,
typename boost::chrono::detail::duration_divide_result<
duration<Rep1, Period>, Rep2>::type
@@ -595,13 +593,13 @@
operator/(const duration<Rep1, Period>& d, const Rep2& s)
{
typedef typename common_type<Rep1, Rep2>::type CR;
- duration<CR, Period> r = d;
- r /= static_cast<CR>(s);
- return r;
+ typedef duration<CR, Period> CD;
+
+ return CD(CD(d).count()/static_cast<CR>(s));
}
template <class Rep1, class Period1, class Rep2, class Period2>
- inline
+ inline BOOST_CHRONO_CONSTEXPR
typename common_type<Rep1, Rep2>::type
operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs)
{
@@ -612,7 +610,7 @@
#ifdef BOOST_CHRONO_EXTENSIONS
template <class Rep1, class Rep2, class Period>
- inline
+ inline BOOST_CHRONO_CONSTEXPR
typename boost::disable_if <boost::chrono::detail::is_duration<Rep1>,
typename boost::chrono::detail::duration_divide_result2<
Rep1, duration<Rep2, Period> >::type
@@ -620,13 +618,15 @@
operator/(const Rep1& s, const duration<Rep2, Period>& d)
{
typedef typename common_type<Rep1, Rep2>::type CR;
- duration<CR, Period> r = d;
- return static_cast<CR>(s)/r.count();
+ typedef duration<CR, Period> CD;
+
+ return static_cast<CR>(s)/CD(d).count();
}
#endif
// Duration %
template <class Rep1, class Period, class Rep2>
+ inline BOOST_CHRONO_CONSTEXPR
typename boost::disable_if <boost::chrono::detail::is_duration<Rep2>,
typename boost::chrono::detail::duration_modulo_result<
duration<Rep1, Period>, Rep2>::type
@@ -634,20 +634,20 @@
operator%(const duration<Rep1, Period>& d, const Rep2& s)
{
typedef typename common_type<Rep1, Rep2>::type CR;
- duration<CR, Period> r = d;
- r %= static_cast<CR>(s);
- return r;
+ typedef duration<CR, Period> CD;
+
+ return CD(CD(d).count()%static_cast<CR>(s));
}
template <class Rep1, class Period1, class Rep2, class Period2>
+ inline BOOST_CHRONO_CONSTEXPR
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2> >::type
operator%(const duration<Rep1, Period1>& lhs,
const duration<Rep2, Period2>& rhs) {
typedef typename common_type<duration<Rep1, Period1>,
duration<Rep2, Period2> >::type CD;
- CD r(lhs);
- r%=CD(rhs);
- return r;
+
+ return CD(CD(lhs).count()%CD(rhs).count());
}
Added: branches/release/boost/chrono/floor.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/chrono/floor.hpp 2011-10-07 18:04:11 EDT (Fri, 07 Oct 2011)
@@ -0,0 +1,34 @@
+// boost/chrono/round.hpp ------------------------------------------------------------//
+
+// (C) Copyright Howard Hinnant
+// Copyright 2011 Vicente J. Botet Escriba
+
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/chrono for documentation.
+
+#ifndef BOOST_CHRONO_FLOOR_HPP
+#define BOOST_CHRONO_FLOOR_HPP
+
+#include <boost/chrono/duration.hpp>
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ /**
+ * rounds down
+ */
+ template <class To, class Rep, class Period>
+ To floor(const duration<Rep, Period>& d)
+ {
+ return duration_cast<To>(d);
+ }
+
+
+ } // namespace chrono
+} // namespace boost
+
+#endif
Modified: branches/release/boost/chrono/process_cpu_clocks.hpp
==============================================================================
--- branches/release/boost/chrono/process_cpu_clocks.hpp (original)
+++ branches/release/boost/chrono/process_cpu_clocks.hpp 2011-10-07 18:04:11 EDT (Fri, 07 Oct 2011)
@@ -10,12 +10,17 @@
#ifndef BOOST_CHRONO_PROCESS_CPU_CLOCKS_HPP
#define BOOST_CHRONO_PROCESS_CPU_CLOCKS_HPP
+
+
+#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS)
+
#include <boost/chrono/duration.hpp>
#include <boost/chrono/time_point.hpp>
#include <boost/system/error_code.hpp>
#include <boost/operators.hpp>
#include <boost/chrono/detail/system.hpp>
#include <iostream>
+#include <boost/type_traits/common_type.hpp>
#ifndef BOOST_CHRONO_HEADER_ONLY
@@ -32,8 +37,8 @@
typedef chrono::time_point<process_real_cpu_clock> time_point;
BOOST_CHRONO_STATIC_CONSTEXPR bool is_steady = true;
- static BOOST_CHRONO_INLINE time_point now(
- system::error_code & ec = BOOST_CHRONO_THROWS );
+ static BOOST_CHRONO_INLINE time_point now() BOOST_CHRONO_NOEXCEPT;
+ static BOOST_CHRONO_INLINE time_point now(system::error_code & ec );
};
class BOOST_CHRONO_DECL process_user_cpu_clock {
@@ -44,8 +49,8 @@
typedef chrono::time_point<process_user_cpu_clock> time_point;
BOOST_CHRONO_STATIC_CONSTEXPR bool is_steady = true;
- static BOOST_CHRONO_INLINE time_point now(
- system::error_code & ec = BOOST_CHRONO_THROWS );
+ static BOOST_CHRONO_INLINE time_point now() BOOST_CHRONO_NOEXCEPT;
+ static BOOST_CHRONO_INLINE time_point now(system::error_code & ec );
};
class BOOST_CHRONO_DECL process_system_cpu_clock {
@@ -56,84 +61,103 @@
typedef chrono::time_point<process_system_cpu_clock> time_point;
BOOST_CHRONO_STATIC_CONSTEXPR bool is_steady = true;
- static BOOST_CHRONO_INLINE time_point now(
- system::error_code & ec = BOOST_CHRONO_THROWS );
+ static BOOST_CHRONO_INLINE time_point now() BOOST_CHRONO_NOEXCEPT;
+ static BOOST_CHRONO_INLINE time_point now(system::error_code & ec );
};
- struct process_cpu_clock_times
- : arithmetic<process_cpu_clock_times,
- multiplicative<process_cpu_clock_times, process_real_cpu_clock::rep,
- less_than_comparable<process_cpu_clock_times> > >
+ template <typename Rep>
+ struct process_times
+ : arithmetic<process_times<Rep>,
+ multiplicative<process_times<Rep>, Rep,
+ less_than_comparable<process_times<Rep> > > >
{
- typedef process_real_cpu_clock::rep rep;
- process_cpu_clock_times()
+ //typedef process_real_cpu_clock::rep rep;
+ typedef Rep rep;
+ process_times()
: real(0)
, user(0)
, system(0){}
- process_cpu_clock_times(
- process_real_cpu_clock::rep r,
- process_user_cpu_clock::rep u,
- process_system_cpu_clock::rep s)
+ template <typename Rep2>
+ explicit process_times(
+ Rep2 r)
+ : real(r)
+ , user(r)
+ , system(r){}
+ template <typename Rep2>
+ explicit process_times(
+ process_times<Rep2> const& rhs)
+ : real(rhs.real)
+ , user(rhs.user)
+ , system(rhs.system){}
+ process_times(
+ rep r,
+ rep u,
+ rep s)
: real(r)
, user(u)
, system(s){}
- process_real_cpu_clock::rep real; // real (i.e wall clock) time
- process_user_cpu_clock::rep user; // user cpu time
- process_system_cpu_clock::rep system; // system cpu time
+ rep real; // real (i.e wall clock) time
+ rep user; // user cpu time
+ rep system; // system cpu time
- bool operator==(process_cpu_clock_times const& rhs) {
+ operator rep() const
+ {
+ return real;
+ }
+ template <typename Rep2>
+ bool operator==(process_times<Rep2> const& rhs) {
return (real==rhs.real &&
user==rhs.user &&
system==rhs.system);
}
- process_cpu_clock_times operator+=(
- process_cpu_clock_times const& rhs)
+ process_times& operator+=(
+ process_times const& rhs)
{
real+=rhs.real;
user+=rhs.user;
system+=rhs.system;
return *this;
}
- process_cpu_clock_times operator-=(
- process_cpu_clock_times const& rhs)
+ process_times& operator-=(
+ process_times const& rhs)
{
real-=rhs.real;
user-=rhs.user;
system-=rhs.system;
return *this;
}
- process_cpu_clock_times operator*=(
- process_cpu_clock_times const& rhs)
+ process_times& operator*=(
+ process_times const& rhs)
{
real*=rhs.real;
user*=rhs.user;
system*=rhs.system;
return *this;
}
- process_cpu_clock_times operator*=(rep const& rhs)
+ process_times& operator*=(rep const& rhs)
{
real*=rhs;
user*=rhs;
system*=rhs;
return *this;
}
- process_cpu_clock_times operator/=(process_cpu_clock_times const& rhs)
+ process_times& operator/=(process_times const& rhs)
{
real/=rhs.real;
user/=rhs.user;
system/=rhs.system;
return *this;
}
- process_cpu_clock_times operator/=(rep const& rhs)
+ process_times& operator/=(rep const& rhs)
{
real/=rhs;
user/=rhs;
system/=rhs;
return *this;
}
- bool operator<(process_cpu_clock_times const & rhs) const
+ bool operator<(process_times const & rhs) const
{
if (real < rhs.real) return true;
if (real > rhs.real) return false;
@@ -168,7 +192,100 @@
}
}
};
+}
+template <class Rep1, class Rep2>
+struct common_type<
+ chrono::process_times<Rep1>,
+ chrono::process_times<Rep2>
+>
+{
+ typedef chrono::process_times<typename common_type<Rep1, Rep2>::type> type;
+};
+
+template <class Rep1, class Rep2>
+struct common_type<
+ chrono::process_times<Rep1>,
+ Rep2
+>
+{
+ typedef chrono::process_times<typename common_type<Rep1, Rep2>::type> type;
+};
+
+template <class Rep1, class Rep2>
+struct common_type<
+ Rep1,
+ chrono::process_times<Rep2>
+>
+{
+ typedef chrono::process_times<typename common_type<Rep1, Rep2>::type> type;
+};
+
+
+namespace chrono
+{
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ inline BOOST_CHRONO_CONSTEXPR
+ bool
+ operator==(const duration<process_times<Rep1>, Period1>& lhs,
+ const duration<process_times<Rep2>, Period2>& rhs)
+ {
+ return boost::chrono::detail::duration_eq<
+ duration<process_times<Rep1>, Period1>, duration<process_times<Rep2>, Period2> >()(lhs, rhs);
+ }
+
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ inline BOOST_CHRONO_CONSTEXPR
+ bool
+ operator==(const duration<process_times<Rep1>, Period1>& lhs,
+ const duration<Rep2, Period2>& rhs)
+ {
+ return boost::chrono::detail::duration_eq<
+ duration<Rep1, Period1>, duration<Rep2, Period2> >()(duration<Rep1, Period1>(lhs.count().real), rhs);
+ }
+
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ inline BOOST_CHRONO_CONSTEXPR
+ bool
+ operator==(const duration<Rep1, Period1>& lhs,
+ const duration<process_times<Rep2>, Period2>& rhs)
+ {
+ return rhs == lhs;
+ }
+
+
+ // Duration <
+
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ inline BOOST_CHRONO_CONSTEXPR
+ bool
+ operator< (const duration<process_times<Rep1>, Period1>& lhs,
+ const duration<Rep2, Period2>& rhs)
+ {
+ return boost::chrono::detail::duration_lt<
+ duration<Rep1, Period1>, duration<Rep2, Period2> >()(duration<Rep1, Period1>(lhs.count().real), rhs);
+ }
+
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ inline BOOST_CHRONO_CONSTEXPR
+ bool
+ operator< (const duration<Rep1, Period1>& lhs,
+ const duration<process_times<Rep2>, Period2>& rhs)
+ {
+ return rhs < lhs;
+ }
+
+ template <class Rep1, class Period1, class Rep2, class Period2>
+ inline BOOST_CHRONO_CONSTEXPR
+ bool
+ operator< (const duration<process_times<Rep1>, Period1>& lhs,
+ const duration<process_times<Rep2>, Period2>& rhs)
+ {
+ return boost::chrono::detail::duration_lt<
+ duration<Rep1, Period1>, duration<Rep2, Period2> >()(lhs, rhs);
+ }
+
+ typedef process_times<nanoseconds::rep> process_cpu_clock_times;
class BOOST_CHRONO_DECL process_cpu_clock
{
public:
@@ -180,48 +297,49 @@
typedef chrono::time_point<process_cpu_clock> time_point;
BOOST_CHRONO_STATIC_CONSTEXPR bool is_steady = true;
+ static BOOST_CHRONO_INLINE time_point now() BOOST_CHRONO_NOEXCEPT;
static BOOST_CHRONO_INLINE time_point now(
- system::error_code & ec = BOOST_CHRONO_THROWS );
+ system::error_code & ec );
};
- template <class CharT, class Traits>
+ template <class CharT, class Traits, typename Rep>
std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os,
- process_cpu_clock_times const& rhs)
+ process_times<Rep> const& rhs)
{
rhs.print(os);
return os;
}
- template <class CharT, class Traits>
+ template <class CharT, class Traits, typename Rep>
std::basic_istream<CharT, Traits>&
operator>>(std::basic_istream<CharT, Traits>& is,
- process_cpu_clock_times const& rhs)
+ process_times<Rep> const& rhs)
{
rhs.read(is);
return is;
}
- template <>
- struct duration_values<process_cpu_clock_times>
+ template <typename Rep>
+ struct duration_values<process_times<Rep> >
{
- typedef process_cpu_clock_times Rep;
+ typedef process_times<Rep> Res;
public:
- static Rep zero()
+ static Res zero()
{
- return Rep();
+ return Res();
}
- static Rep max BOOST_PREVENT_MACRO_SUBSTITUTION ()
+ static Res max BOOST_PREVENT_MACRO_SUBSTITUTION ()
{
- return Rep((std::numeric_limits<process_real_cpu_clock::rep>::max)(),
- (std::numeric_limits<process_user_cpu_clock::rep>::max)(),
- (std::numeric_limits<process_system_cpu_clock::rep>::max)());
+ return Res((std::numeric_limits<Rep>::max)(),
+ (std::numeric_limits<Rep>::max)(),
+ (std::numeric_limits<Rep>::max)());
}
- static Rep min BOOST_PREVENT_MACRO_SUBSTITUTION ()
+ static Res min BOOST_PREVENT_MACRO_SUBSTITUTION ()
{
- return Rep((std::numeric_limits<process_real_cpu_clock::rep>::min)(),
- (std::numeric_limits<process_user_cpu_clock::rep>::min)(),
- (std::numeric_limits<process_system_cpu_clock::rep>::min)());
+ return Res((std::numeric_limits<Rep>::min)(),
+ (std::numeric_limits<Rep>::min)(),
+ (std::numeric_limits<Rep>::min)());
}
};
@@ -230,44 +348,41 @@
namespace std {
- template <>
- class numeric_limits<boost::chrono::process_cpu_clock::times>
+ template <typename Rep>
+ struct numeric_limits<boost::chrono::process_times<Rep> >
{
- typedef boost::chrono::process_cpu_clock::times Rep;
+ typedef boost::chrono::process_times<Rep> Res;
public:
static const bool is_specialized = true;
- static Rep min BOOST_PREVENT_MACRO_SUBSTITUTION ()
+ static Res min BOOST_PREVENT_MACRO_SUBSTITUTION ()
{
- return Rep((std::numeric_limits<boost::chrono::process_real_cpu_clock::rep>::min)(),
- (std::numeric_limits<boost::chrono::process_user_cpu_clock::rep>::min)(),
- (std::numeric_limits<boost::chrono::process_system_cpu_clock::rep>::min)());
+ return Res((std::numeric_limits<Rep>::min)(),
+ (std::numeric_limits<Rep>::min)(),
+ (std::numeric_limits<Rep>::min)());
}
- static Rep max BOOST_PREVENT_MACRO_SUBSTITUTION ()
+ static Res max BOOST_PREVENT_MACRO_SUBSTITUTION ()
{
- return Rep((std::numeric_limits<boost::chrono::process_real_cpu_clock::rep>::max)(),
- (std::numeric_limits<boost::chrono::process_user_cpu_clock::rep>::max)(),
- (std::numeric_limits<boost::chrono::process_system_cpu_clock::rep>::max)());
+ return Res((std::numeric_limits<Rep>::max)(),
+ (std::numeric_limits<Rep>::max)(),
+ (std::numeric_limits<Rep>::max)());
}
- static Rep lowest() throw()
+ static Res lowest() throw()
{
return (min)();
}
- static const int digits = std::numeric_limits<boost::chrono::process_real_cpu_clock::rep>::digits+
- std::numeric_limits<boost::chrono::process_user_cpu_clock::rep>::digits+
- std::numeric_limits<boost::chrono::process_system_cpu_clock::rep>::digits;
- static const int digits10 = std::numeric_limits<boost::chrono::process_real_cpu_clock::rep>::digits10+
- std::numeric_limits<boost::chrono::process_user_cpu_clock::rep>::digits10+
- std::numeric_limits<boost::chrono::process_system_cpu_clock::rep>::digits10;
- //~ static const int max_digits10 = std::numeric_limits<boost::chrono::process_real_cpu_clock::rep>::max_digits10+
- //~ std::numeric_limits<boost::chrono::process_user_cpu_clock::rep>::max_digits10+
- //~ std::numeric_limits<boost::chrono::process_system_cpu_clock::rep>::max_digits10;
- static const bool is_signed = false;
- static const bool is_integer = true;
- static const bool is_exact = true;
+ static const int digits = std::numeric_limits<Rep>::digits+
+ std::numeric_limits<Rep>::digits+
+ std::numeric_limits<Rep>::digits;
+ static const int digits10 = std::numeric_limits<Rep>::digits10+
+ std::numeric_limits<Rep>::digits10+
+ std::numeric_limits<Rep>::digits10;
+ static const bool is_signed = Rep::is_signed;
+ static const bool is_integer = Rep::is_integer;
+ static const bool is_exact = Rep::is_exact;
static const int radix = 0;
- //~ static Rep epsilon() throw() { return 0; }
- //~ static Rep round_error() throw() { return 0; }
+ //~ static Res epsilon() throw() { return 0; }
+ //~ static Res round_error() throw() { return 0; }
//~ static const int min_exponent = 0;
//~ static const int min_exponent10 = 0;
//~ static const int max_exponent = 0;
@@ -277,10 +392,10 @@
//~ static const bool has_signaling_NaN = false;
//~ static const float_denorm_style has_denorm = denorm_absent;
//~ static const bool has_denorm_loss = false;
- //~ static Rep infinity() throw() { return 0; }
- //~ static Rep quiet_NaN() throw() { return 0; }
- //~ static Rep signaling_NaN() throw() { return 0; }
- //~ static Rep denorm_min() throw() { return 0; }
+ //~ static Res infinity() throw() { return 0; }
+ //~ static Res quiet_NaN() throw() { return 0; }
+ //~ static Res signaling_NaN() throw() { return 0; }
+ //~ static Res denorm_min() throw() { return 0; }
//~ static const bool is_iec559 = false;
//~ static const bool is_bounded = true;
//~ static const bool is_modulo = false;
@@ -296,5 +411,6 @@
#else
#include <boost/chrono/detail/inlined/process_cpu_clocks.hpp>
#endif
+#endif
#endif // BOOST_CHRONO_PROCESS_CPU_CLOCKS_HPP
Added: branches/release/boost/chrono/round.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/chrono/round.hpp 2011-10-07 18:04:11 EDT (Fri, 07 Oct 2011)
@@ -0,0 +1,55 @@
+// boost/chrono/round.hpp ------------------------------------------------------------//
+
+// (C) Copyright Howard Hinnant
+// Copyright 2011 Vicente J. Botet Escriba
+
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/chrono for documentation.
+
+#ifndef BOOST_CHRONO_ROUND_HPP
+#define BOOST_CHRONO_ROUND_HPP
+
+#include <boost/chrono/duration.hpp>
+#include <boost/chrono/duration.hpp>
+//#include <boost/chrono/typeof/boost/chrono/chrono.hpp>
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ /**
+ * rounds to nearest, to even on tie
+ */
+ template <class To, class Rep, class Period>
+ To round(const duration<Rep, Period>& d)
+ {
+ To t0 = duration_cast<To>(d);
+ To t1 = t0;
+ ++t1;
+#if 0
+ // Avoid the user of BOOST_AUTO to make the library portable to Sun, PGI, ..
+ BOOST_AUTO(diff0, d - t0);
+ BOOST_AUTO(diff1, t1 - d);
+#else
+ typedef typename common_type<To, duration<Rep, Period> >::type result_type;
+ result_type diff0 = d - t0;
+ result_type diff1 = t1 - d;
+#endif
+ if (diff0 == diff1)
+ {
+ if (t0.count() & 1)
+ return t1;
+ return t0;
+ }
+ else if (diff0 < diff1)
+ return t0;
+ return t1;
+ }
+
+ } // namespace chrono
+} // namespace boost
+
+#endif
Modified: branches/release/boost/chrono/system_clocks.hpp
==============================================================================
--- branches/release/boost/chrono/system_clocks.hpp (original)
+++ branches/release/boost/chrono/system_clocks.hpp 2011-10-07 18:04:11 EDT (Fri, 07 Oct 2011)
@@ -127,11 +127,11 @@
typedef chrono::time_point<system_clock> time_point;
BOOST_CHRONO_STATIC_CONSTEXPR bool is_steady = false;
- static BOOST_CHRONO_INLINE time_point now(); // throws on error
- static BOOST_CHRONO_INLINE time_point now(system::error_code & ec); // never throws
+ static BOOST_CHRONO_INLINE time_point now() BOOST_CHRONO_NOEXCEPT;
+ static BOOST_CHRONO_INLINE time_point now(system::error_code & ec);
- static BOOST_CHRONO_INLINE std::time_t to_time_t(const time_point& t);
- static BOOST_CHRONO_INLINE time_point from_time_t(std::time_t t);
+ static BOOST_CHRONO_INLINE std::time_t to_time_t(const time_point& t) BOOST_CHRONO_NOEXCEPT;
+ static BOOST_CHRONO_INLINE time_point from_time_t(std::time_t t) BOOST_CHRONO_NOEXCEPT;
};
//----------------------------------------------------------------------------//
@@ -151,8 +151,8 @@
typedef chrono::time_point<steady_clock> time_point;
BOOST_CHRONO_STATIC_CONSTEXPR bool is_steady = true;
- static BOOST_CHRONO_INLINE time_point now(); // throws on error
- static BOOST_CHRONO_INLINE time_point now(system::error_code & ec); // never throws
+ static BOOST_CHRONO_INLINE time_point now() BOOST_CHRONO_NOEXCEPT;
+ static BOOST_CHRONO_INLINE time_point now(system::error_code & ec);
};
#endif
//----------------------------------------------------------------------------//
Modified: branches/release/boost/chrono/thread_clock.hpp
==============================================================================
--- branches/release/boost/chrono/thread_clock.hpp (original)
+++ branches/release/boost/chrono/thread_clock.hpp 2011-10-07 18:04:11 EDT (Fri, 07 Oct 2011)
@@ -10,6 +10,8 @@
#ifndef BOOST_CHRONO_THREAD_CLOCK_HPP
#define BOOST_CHRONO_THREAD_CLOCK_HPP
+#if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
+
#include <boost/chrono/config.hpp>
#include <boost/chrono/duration.hpp>
#include <boost/chrono/time_point.hpp>
@@ -20,8 +22,6 @@
#include <boost/config/abi_prefix.hpp> // must be the last #include
#endif
-#if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
-
namespace boost { namespace chrono {
class BOOST_CHRONO_DECL thread_clock {
@@ -32,13 +32,12 @@
typedef chrono::time_point<thread_clock> time_point;
BOOST_CHRONO_STATIC_CONSTEXPR bool is_steady = BOOST_CHRONO_THREAD_CLOCK_IS_STEADY;
- static BOOST_CHRONO_INLINE time_point now( );
+ static BOOST_CHRONO_INLINE time_point now( ) BOOST_CHRONO_NOEXCEPT;
static BOOST_CHRONO_INLINE time_point now( system::error_code & ec );
};
} // namespace chrono
} // namespace boost
-#endif
#ifndef BOOST_CHRONO_HEADER_ONLY
#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas
@@ -46,4 +45,6 @@
#include <boost/chrono/detail/inlined/thread_clock.hpp>
#endif
+#endif
+
#endif // BOOST_CHRONO_THREAD_CLOCK_HPP
Modified: branches/release/boost/chrono/time_point.hpp
==============================================================================
--- branches/release/boost/chrono/time_point.hpp (original)
+++ branches/release/boost/chrono/time_point.hpp 2011-10-07 18:04:11 EDT (Fri, 07 Oct 2011)
@@ -78,24 +78,28 @@
// time_point arithmetic
template <class Clock, class Duration1, class Rep2, class Period2>
+ inline BOOST_CHRONO_CONSTEXPR
time_point<Clock,
typename common_type<Duration1, duration<Rep2, Period2> >::type>
operator+(
const time_point<Clock, Duration1>& lhs,
const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Clock, class Duration2>
+ inline BOOST_CHRONO_CONSTEXPR
time_point<Clock,
typename common_type<duration<Rep1, Period1>, Duration2>::type>
operator+(
const duration<Rep1, Period1>& lhs,
const time_point<Clock, Duration2>& rhs);
template <class Clock, class Duration1, class Rep2, class Period2>
+ inline BOOST_CHRONO_CONSTEXPR
time_point<Clock,
typename common_type<Duration1, duration<Rep2, Period2> >::type>
operator-(
const time_point<Clock, Duration1>& lhs,
const duration<Rep2, Period2>& rhs);
template <class Clock, class Duration1, class Duration2>
+ inline BOOST_CHRONO_CONSTEXPR
typename common_type<Duration1, Duration2>::type
operator-(
const time_point<Clock, Duration1>& lhs,
@@ -229,25 +233,24 @@
// time_point operator+(time_point x, duration y);
template <class Clock, class Duration1, class Rep2, class Period2>
- inline
+ inline BOOST_CHRONO_CONSTEXPR
time_point<Clock,
typename common_type<Duration1, duration<Rep2, Period2> >::type>
operator+(const time_point<Clock, Duration1>& lhs,
const duration<Rep2, Period2>& rhs)
{
- typedef time_point<
- Clock,
- typename common_type<Duration1, duration<Rep2, Period2> >::type
- > TimeResult;
- TimeResult r(lhs);
- r += rhs;
- return r;
+ typedef typename common_type<Duration1, duration<Rep2, Period2> >::type CDuration;
+ typedef time_point<
+ Clock,
+ CDuration
+ > TimeResult;
+ return TimeResult(lhs.time_since_epoch() + CDuration(rhs));
}
// time_point operator+(duration x, time_point y);
template <class Rep1, class Period1, class Clock, class Duration2>
- inline
+ inline BOOST_CHRONO_CONSTEXPR
time_point<Clock,
typename common_type<duration<Rep1, Period1>, Duration2>::type>
operator+(const duration<Rep1, Period1>& lhs,
@@ -259,7 +262,7 @@
// time_point operator-(time_point x, duration y);
template <class Clock, class Duration1, class Rep2, class Period2>
- inline
+ inline BOOST_CHRONO_CONSTEXPR
time_point<Clock,
typename common_type<Duration1, duration<Rep2, Period2> >::type>
operator-(const time_point<Clock, Duration1>& lhs,
@@ -271,7 +274,7 @@
// duration operator-(time_point x, time_point y);
template <class Clock, class Duration1, class Duration2>
- inline
+ inline BOOST_CHRONO_CONSTEXPR
typename common_type<Duration1, Duration2>::type
operator-(const time_point<Clock, Duration1>& lhs,
const time_point<Clock, Duration2>& rhs)
Added: branches/release/libs/chrono/example/rounding.cpp
==============================================================================
--- (empty file)
+++ branches/release/libs/chrono/example/rounding.cpp 2011-10-07 18:04:11 EDT (Fri, 07 Oct 2011)
@@ -0,0 +1,44 @@
+// french.cpp ----------------------------------------------------------//
+
+// Copyright 2010 Howard Hinnant
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Adapted to Boost from the original Hawards's code
+
+#include <iostream>
+//#include <boost/chrono/chrono_io.hpp>
+#include <boost/chrono/floor.hpp>
+#include <boost/chrono/round.hpp>
+#include <boost/chrono/ceil.hpp>
+
+int main()
+{
+ boost::chrono::milliseconds ms(2500);
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
+ std::cout << boost::chrono::floor<boost::chrono::seconds>(ms).count()
+ << " seconds\n";
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
+ std::cout << boost::chrono::round<boost::chrono::seconds>(ms).count()
+ << " seconds\n";
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
+ std::cout << boost::chrono::ceil<boost::chrono::seconds>(ms).count()
+ << " seconds\n";
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
+ ms = boost::chrono::milliseconds(2516);
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
+ typedef boost::chrono::duration<long, boost::ratio<1, 30> > frame_rate;
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
+ std::cout << boost::chrono::floor<frame_rate>(ms).count()
+ << " [1/30] seconds\n";
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
+ std::cout << boost::chrono::round<frame_rate>(ms).count()
+ << " [1/30] seconds\n";
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
+ std::cout << boost::chrono::ceil<frame_rate>(ms).count()
+ << " [1/30] seconds\n";
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
+
+ return 0;
+}
Modified: branches/release/libs/chrono/example/test_thread_clock.cpp
==============================================================================
--- branches/release/libs/chrono/example/test_thread_clock.cpp (original)
+++ branches/release/libs/chrono/example/test_thread_clock.cpp 2011-10-07 18:04:11 EDT (Fri, 07 Oct 2011)
@@ -11,11 +11,12 @@
#include <iostream>
-using namespace boost::chrono;
void test_thread_clock()
{
#if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
+ using namespace boost::chrono;
+
std::cout << "thread_clock test" << std::endl;
thread_clock::duration delay = milliseconds(5);
thread_clock::time_point start = thread_clock::now();
Modified: branches/release/libs/chrono/test/Jamfile.v2
==============================================================================
--- branches/release/libs/chrono/test/Jamfile.v2 (original)
+++ branches/release/libs/chrono/test/Jamfile.v2 2011-10-07 18:04:11 EDT (Fri, 07 Oct 2011)
@@ -47,19 +47,19 @@
{
return
[ run $(sources) ../build//boost_chrono
- : :
- :
+ : :
+ :
<library>/boost/system//boost_system
: $(sources[1]:B)_shared ]
- [ run $(sources) ../build//boost_chrono/<link>static
- : :
- :
- <library>/boost/system//boost_system
- : $(sources[1]:B)_static ]
+ #[ run $(sources) ../build//boost_chrono/<link>static
+ # : :
+ # :
+ # <library>/boost/system//boost_system
+ # : $(sources[1]:B)_static ]
[ run $(sources)
- : :
+ : :
: <define>BOOST_CHRONO_HEADER_ONLY
- # comment one of the following lines
+ # comment one of the following lines
#<define>BOOST_SYSTEM_INLINED
<library>/boost/system//boost_system
: $(sources[1]:B)_header ]
@@ -69,19 +69,19 @@
{
return
[ run $(sources) ../build//boost_chrono
- : :
- :
+ : :
+ :
<library>/boost/system//boost_system
: $(name)_shared ]
- [ run $(sources) ../build//boost_chrono/<link>static
- : :
- :
- <library>/boost/system//boost_system
- : $(name)_static ]
+ #[ run $(sources) ../build//boost_chrono/<link>static
+ # : :
+ # :
+ # <library>/boost/system//boost_system
+ # : $(name)_static ]
[ run $(sources)
- : :
- : <define>BOOST_CHRONO_HEADER_ONLY
- # comment one of the following lines
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ # comment one of the following lines
#<define>BOOST_SYSTEM_INLINED
<library>/boost/system//boost_system
: $(name)_header ]
@@ -93,19 +93,19 @@
{
return
[ run $(sources) ../build//boost_chrono
- : :
- :
- <library>/boost/system//boost_system
+ : :
+ :
+ <library>/boost/system//boost_system
: $(sources[1]:B)_shared ]
- [ run $(sources) ../build//boost_chrono/<link>static
- : :
- :
- <library>/boost/system//boost_system
- : $(sources[1]:B)_static ]
+ #[ run $(sources) ../build//boost_chrono/<link>static
+ # : :
+ # :
+ # <library>/boost/system//boost_system
+ # : $(sources[1]:B)_static ]
[ run $(sources)
- : :
+ : :
: <define>BOOST_CHRONO_HEADER_ONLY
- # comment one of the following lines
+ # comment one of the following lines
#<define>BOOST_SYSTEM_INLINED
<library>/boost/system//boost_system
: $(sources[1]:B)_header ]
@@ -115,33 +115,106 @@
{
return
[ run $(sources) ../build//boost_chrono
- : :
- :
+ : :
+ :
+ <library>/boost/system//boost_system
+ : $(name)_shared ]
+ #[ run $(sources) ../build//boost_chrono/<link>static
+ # : :
+ # :
+ # <library>/boost/system//boost_system
+ # : $(name)_static ]
+ [ run $(sources)
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ # comment one of the following lines
+ #<define>BOOST_SYSTEM_INLINED
+ <library>/boost/system//boost_system
+ : $(name)_header ]
+ ;
+}
+
+rule chrono-run-check ( sources )
+{
+ return
+ [ run $(sources)
+ : :
+ :
+ <library>/boost/system//boost_system
+ : $(sources[1]:B)_shared ]
+ [ run $(sources)
+ : :
+ :
+ <library>/boost/system//boost_system
+ : $(sources[1]:B)_static ]
+ [ run $(sources)
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ # comment one of the following lines
+ #<define>BOOST_SYSTEM_INLINED
+ <library>/boost/system//boost_system
+ : $(sources[1]:B)_header ]
+ ;
+}
+
+rule chrono-run-check2 ( sources : name )
+{
+ return
+ [ run $(sources)
+ : :
+ :
<library>/boost/system//boost_system
: $(name)_shared ]
- [ run $(sources) ../build//boost_chrono/<link>static
- : :
- :
+ [ run $(sources)
+ : :
+ :
<library>/boost/system//boost_system
: $(name)_static ]
[ run $(sources)
- : :
- : <define>BOOST_CHRONO_HEADER_ONLY
- # comment one of the following lines
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ # comment one of the following lines
#<define>BOOST_SYSTEM_INLINED
<library>/boost/system//boost_system
: $(name)_header ]
;
}
+
+rule chrono-run-header ( sources )
+{
+ return
+ [ run $(sources)
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ # comment one of the following lines
+ #<define>BOOST_SYSTEM_INLINED
+ <library>/boost/system//boost_system
+ : $(sources[1]:B)_header ]
+ ;
+}
+
+rule chrono-run-header2 ( sources : name )
+{
+ return
+ [ run $(sources)
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ # comment one of the following lines
+ #<define>BOOST_SYSTEM_INLINED
+ <library>/boost/system//boost_system
+ : $(name)_header ]
+ ;
+}
+
rule chrono-compile ( sources )
{
return
[ compile $(sources)
- :
+ :
: $(sources[1]:B)_lib ]
[ compile $(sources)
- : <define>BOOST_CHRONO_HEADER_ONLY
- # comment the following line
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ # comment the following line
<define>BOOST_SYSTEM_INLINED
: $(sources[1]:B)_header ]
;
@@ -155,32 +228,33 @@
: $(name)_lib ]
[ compile $(sources)
: <define>BOOST_CHRONO_HEADER_ONLY
- # comment the following line
+ # comment the following line
<define>BOOST_SYSTEM_INLINED
: $(name)_header ]
;
}
+
test-suite "examples"
:
- [ chrono-run ../example/cycle_count.cpp ]
- [ chrono-run ../example/runtime_resolution.cpp ]
- [ chrono-run ../example/xtime.cpp ]
- [ chrono-run ../example/saturating.cpp ]
+ [ chrono-run-header ../example/cycle_count.cpp ]
+ [ chrono-run-header ../example/runtime_resolution.cpp ]
+ [ chrono-run-header ../example/xtime.cpp ]
+ [ chrono-run-header ../example/saturating.cpp ]
[ chrono-run ../example/min_time_point.cpp ]
- [ chrono-run ../example/i_dont_like_the_default_duration_behavior.cpp ]
+ [ chrono-run-header ../example/i_dont_like_the_default_duration_behavior.cpp ]
[ chrono-run ../example/simulated_thread_interface_demo.cpp ]
- [ chrono-run ../example/timeval_demo.cpp ]
+ [ chrono-run-header ../example/timeval_demo.cpp ]
[ chrono-run ../example/chrono_unit_test.cpp ]
- [ chrono-run ../example/explore_limits.cpp ]
- [ chrono-run ../example/test_duration.cpp ]
+ [ chrono-run-header ../example/explore_limits.cpp ]
+ [ chrono-run-header ../example/test_duration.cpp ]
[ chrono-run ../example/test_clock.cpp ]
- [ chrono-run ../example/miscellaneous.cpp ]
- [ chrono-run ../example/test_special_values.cpp ]
+ [ chrono-run-header ../example/miscellaneous.cpp ]
+ [ chrono-run-header ../example/test_special_values.cpp ]
[ chrono-run ../example/manipulate_clock_object.cpp ]
- [ chrono-run ../example/chrono_accuracy_test.cpp ]
+ #[ chrono-run ../example/chrono_accuracy_test.cpp ]
[ chrono-run-mt ../example/test_thread_clock.cpp ]
- [ chrono-run ../example/french.cpp ]
+ [ chrono-run-header ../example/rounding.cpp ]
#[ chrono-run ../example/await_keystroke.cpp ]
;
@@ -189,7 +263,7 @@
[ chrono-compile2 traits/common_type_duration_pass.cpp : traits_common_type_duration_pass ]
[ chrono-compile2 traits/common_type_time_point_pass.cpp : traits_common_type_time_point_pass ]
[ chrono-compile2 traits/treat_as_floating_point_pass.cpp : traits_treat_as_floating_point_pass ]
- [ chrono-run2 traits/duration_values_pass.cpp : traits_duration_values_pass ]
+ [ chrono-run-header2 traits/duration_values_pass.cpp : traits_duration_values_pass ]
;
test-suite "duration"
@@ -201,11 +275,11 @@
[ chrono-compile duration/types_pass.cpp ]
[ chrono-compile duration/ratio_alias_pass.cpp ]
[ chrono-compile duration/typedefs_pass.cpp ]
- [ chrono-run duration/arithmetic_pass.cpp ]
- [ chrono-run duration/duration_cast_pass.cpp ]
+ [ chrono-run-header duration/arithmetic_pass.cpp ]
+ [ chrono-run-header duration/duration_cast_pass.cpp ]
[ compile-fail duration/duration_cast_int_fail.cpp ]
- [ chrono-run duration/comparisons_pass.cpp ]
- [ chrono-run duration/constructor_pass.cpp ]
+ [ chrono-run-header duration/comparisons_pass.cpp ]
+ [ chrono-run-header duration/constructor_pass.cpp ]
[ compile-fail duration/cons/convert_float_to_int_fail.cpp ]
[ compile-fail duration/cons/convert_inexact_fail.cpp ]
[ compile-fail duration/cons/implicit_constructot_fail.cpp ]
@@ -215,42 +289,78 @@
[ compile-fail duration/nonmember/modulus_rep2_fail.cpp ]
[ compile-fail duration/nonmember/times_rep2_lhs_fail.cpp ]
[ compile-fail duration/nonmember/times_rep2_rhs_fail.cpp ]
- [ chrono-run duration/duration_values_pass.cpp ]
+ [ chrono-run-header duration/duration_values_pass.cpp ]
;
test-suite "time_point"
:
[ chrono-compile2 time_point/default_duration_pass.cpp : time_point_default_duration_pass ]
[ compile-fail time_point/not_duration_fail.cpp : : time_point_not_duration_fail ]
- [ chrono-run2 time_point/arithmetic_pass.cpp : time_point_arithmetic_pass ]
- [ chrono-run2 time_point/arithmetic_ext_pass.cpp : time_point_arithmetic_ext_pass ]
- [ chrono-run2 time_point/time_point_cast_pass.cpp : time_point_time_point_cast_pass ]
+ [ chrono-run-header2 time_point/arithmetic_pass.cpp : time_point_arithmetic_pass ]
+ [ chrono-run-header2 time_point/arithmetic_ext_pass.cpp : time_point_arithmetic_ext_pass ]
+ [ chrono-run-header2 time_point/time_point_cast_pass.cpp : time_point_time_point_cast_pass ]
[ compile-fail time_point/time_point_cast_int_fail.cpp : : time_point_time_point_cast_int_fail ]
- [ chrono-run2 time_point/comparisons_pass.cpp : time_point_comparisons_pass ]
+ [ chrono-run-header2 time_point/comparisons_pass.cpp : time_point_comparisons_pass ]
[ compile-fail time_point/comparisons/equal_fail.cpp : : time_point_equal_fail ]
[ compile-fail time_point/comparisons/less_fail.cpp : : time_point_less_fail ]
- [ chrono-run2 time_point/constructor_pass.cpp : time_point_constructor_pass ]
+ [ chrono-run-header2 time_point/constructor_pass.cpp : time_point_constructor_pass ]
[ compile-fail time_point/cons/implicit_fail.cpp : : time_point_implicit_fail ]
[ compile-fail time_point/cons/non_implicit_convertible_duration_fail.cpp : : time_point_non_implicit_convertible_duration_fail ]
- [ chrono-run2 time_point/min_max_pass.cpp : time_point_min_max_pass ]
+ [ chrono-run-header2 time_point/min_max_pass.cpp : time_point_min_max_pass ]
;
test-suite "clock"
- :
+ :
[ chrono-run2-mt clock/clock_pass.cpp : clock_clock_pass ]
;
- test-suite "io"
+ #test-suite "stopwatch"
+ # :
+ # [ chrono-run2 stopwatch/simple_stopwatch_pass.cpp : simple_stopwatch_pass ]
+ # [ chrono-run2 stopwatch/basic_stopwatch_pass.cpp : basic_stopwatch_pass ]
+ # [ chrono-run2 stopwatch/basic_stopwatch_last_lap_pass.cpp : basic_stopwatch_last_lap_pass ]
+ # [ chrono-run2 stopwatch/basic_stopwatch_laps_accumulator_set_pass.cpp : basic_stopwatch_laps_accumulator_set_pass ]
+ # [ chrono-run2 stopwatch/basic_stopwatch_laps_container_pass.cpp : basic_stopwatch_laps_container_pass ]
+ # [ chrono-run2 stopwatch/suspendable_stopwatch_pass.cpp : suspendable_stopwatch_pass ]
+ # ;
+
+ #test-suite "stopwatch_ex"
+ # :
+ # [ chrono-run ../example/stopwatch_example.cpp ]
+ # ;
+
+ #test-suite "stopclock"
+ # :
+ # [ chrono-run2 stopwatch/simple_stopwatch_reporter_pass.cpp : simple_stopwatch_reporter_pass ]
+ # [ chrono-run2 stopwatch/basic_stopwatch_reporter_pass.cpp : basic_stopwatch_reporter_pass ]
+ # [ chrono-run2 stopwatch/basic_stopwatch_reporter_laps_accumulator_set_pass.cpp : basic_stopwatch_reporter_laps_accumulator_set_pass ]
+ # ;
+
+ #test-suite "stopclock_ex"
+ # :
+ # [ chrono-run2-mt ../example/stopwatch_reporter_example.cpp : stopwatch_reporter_example ]
+ # ;
+
+ test-suite "io_ex"
:
[ chrono-run-mt ../example/io_ex1.cpp ]
- [ chrono-run ../example/io_ex2.cpp ]
+ [ chrono-run-header ../example/io_ex2.cpp ]
[ chrono-run ../example/io_ex3.cpp ]
[ chrono-run ../example/io_ex4.cpp ]
[ chrono-run ../example/io_ex5.cpp ]
+ [ chrono-run ../example/french.cpp ]
;
+ #test-suite "io"
+ # :
+ # [ chrono-run-header io/duration_input.cpp ]
+ # [ chrono-run-header io/duration_output.cpp ]
+ # [ chrono-run-header io/time_point_input.cpp ]
+ # [ chrono-run-header io/time_point_output.cpp ]
+ # ;
+
test-suite "win32"
:
[ chrono-run win32_test.cpp ]
;
-
+
Modified: branches/release/libs/chrono/test/clock/clock_pass.cpp
==============================================================================
--- branches/release/libs/chrono/test/clock/clock_pass.cpp (original)
+++ branches/release/libs/chrono/test/clock/clock_pass.cpp 2011-10-07 18:04:11 EDT (Fri, 07 Oct 2011)
@@ -137,6 +137,7 @@
check_clock_now_throws<boost::chrono::thread_clock>();
#endif
+#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS)
check_clock_invariants<boost::chrono::process_real_cpu_clock>();
BOOST_CHRONO_STATIC_ASSERT(boost::chrono::process_real_cpu_clock::is_steady, NOTHING, ());
check_clock_now<boost::chrono::process_real_cpu_clock>();
@@ -160,6 +161,7 @@
check_clock_now<boost::chrono::process_cpu_clock>();
check_clock_now_ec<boost::chrono::process_cpu_clock>();
check_clock_now_throws<boost::chrono::process_cpu_clock>();
+#endif
return boost::report_errors();
}
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