Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67264 - in sandbox/chrono/boost/chrono: . detail/inlined detail/inlined/mac detail/inlined/posix detail/inlined/win
From: vicente.botet_at_[hidden]
Date: 2010-12-16 01:43:20


Author: viboes
Date: 2010-12-16 01:43:17 EST (Thu, 16 Dec 2010)
New Revision: 67264
URL: http://svn.boost.org/trac/boost/changeset/67264

Log:
Chrono: After review commit

Added:
   sandbox/chrono/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp (contents, props changed)
   sandbox/chrono/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp (contents, props changed)
   sandbox/chrono/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp (contents, props changed)
Text files modified:
   sandbox/chrono/boost/chrono/config.hpp | 10 +++++++++-
   sandbox/chrono/boost/chrono/detail/inlined/mac/process_clock.hpp | 5 -----
   sandbox/chrono/boost/chrono/detail/inlined/posix/process_clock.hpp | 4 ++++
   sandbox/chrono/boost/chrono/detail/inlined/process_cpu_clocks.hpp | 25 +++++++++++++++++++++++--
   sandbox/chrono/boost/chrono/duration.hpp | 26 ++++++++++++++++----------
   sandbox/chrono/boost/chrono/process_cpu_clocks.hpp | 8 ++++----
   sandbox/chrono/boost/chrono/process_times.hpp | 2 +-
   sandbox/chrono/boost/chrono/system_clocks.hpp | 4 ++--
   sandbox/chrono/boost/chrono/thread_clock.hpp | 2 +-
   sandbox/chrono/boost/chrono/time_point.hpp | 26 ++++++++++++++++++--------
   10 files changed, 78 insertions(+), 34 deletions(-)

Modified: sandbox/chrono/boost/chrono/config.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/config.hpp (original)
+++ sandbox/chrono/boost/chrono/config.hpp 2010-12-16 01:43:17 EST (Thu, 16 Dec 2010)
@@ -13,6 +13,11 @@
 
 #include <boost/config.hpp>
 
+
+#if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6))
+#undef BOOST_NO_CONSTEXPR
+#endif
+
 // BOOST_CHRONO_POSIX_API, BOOST_CHRONO_MAC_API, or BOOST_CHRONO_WINDOWS_API
 // can be defined by the user to specify which API should be used
 
@@ -70,15 +75,18 @@
 
 // define constexpr related macros ------------------------------//
 
-//~ #include <boost/config.hpp>
 #if defined(BOOST_NO_CONSTEXPR)
 #define BOOST_CHRONO_CONSTEXPR
+#define BOOST_CHRONO_CONSTEXPR_OR_CONST const
 #define BOOST_CHRONO_CONST_REF const&
 #else
 #define BOOST_CHRONO_CONSTEXPR constexpr
+#define BOOST_CHRONO_CONSTEXPR_OR_CONST constexpr
 #define BOOST_CHRONO_CONST_REF
 #endif
 
+#define BOOST_CHRONO_STATIC_CONSTEXPR static BOOST_CHRONO_CONSTEXPR_OR_CONST
+
 
 #ifdef BOOST_CHRONO_INLINED
 #define BOOST_CHRONO_INLINE inline

Modified: sandbox/chrono/boost/chrono/detail/inlined/mac/process_clock.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/detail/inlined/mac/process_clock.hpp (original)
+++ sandbox/chrono/boost/chrono/detail/inlined/mac/process_clock.hpp 2010-12-16 01:43:17 EST (Thu, 16 Dec 2010)
@@ -17,11 +17,6 @@
 #include <sys/time.h> //for gettimeofday and timeval
 # include <unistd.h>
 
-
-#else
-# error unknown API
-#endif
-
 namespace boost
 {
 namespace chrono

Added: sandbox/chrono/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp 2010-12-16 01:43:17 EST (Thu, 16 Dec 2010)
@@ -0,0 +1,250 @@
+// boost process_cpu_clocks.cpp -----------------------------------------------------------//
+
+// Copyright Beman Dawes 1994, 2006, 2008
+// Copyright Vicente J. Botet Escriba 2009
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// See http://www.boost.org/libs/chrono for documentation.
+
+//--------------------------------------------------------------------------------------//
+
+#include <boost/chrono/config.hpp>
+#include <boost/chrono/process_cpu_clocks.hpp>
+#include <cassert>
+
+#include <sys/time.h> //for gettimeofday and timeval
+# include <unistd.h>
+
+
+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 = ::sysconf( _SC_CLK_TCK )) <= 0 )
+ factor = -1;
+ else
+ {
+ assert( factor <= 1000000l ); // doesn't handle large ticks
+ factor = 1000000l / factor; // compute factor
+ if ( !factor ) factor = -1;
+ }
+ }
+ return factor;
+ }
+}
+
+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
+ {
+ 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 )
+ {
+ 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();
+ }
+ }
+ }
+}
+
+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
+ {
+ ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
+ return time_point();
+ }
+ }
+ else
+ {
+ if ( chrono_detail::tick_factor() != -1 )
+ {
+ 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();
+ }
+ }
+ }
+}
+
+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
+ {
+ ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
+ return time_point();
+ }
+ }
+ else
+ {
+ if ( chrono_detail::tick_factor() != -1 )
+ {
+ 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();
+ }
+ }
+ }
+}
+
+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
+ {
+ 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();
+ }
+ }
+ }
+
+}
+
+} }

Modified: sandbox/chrono/boost/chrono/detail/inlined/posix/process_clock.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/detail/inlined/posix/process_clock.hpp (original)
+++ sandbox/chrono/boost/chrono/detail/inlined/posix/process_clock.hpp 2010-12-16 01:43:17 EST (Thu, 16 Dec 2010)
@@ -67,6 +67,10 @@
             times_.user = microseconds(tm.tms_utime + tm.tms_cutime);
             if ( chrono_detail::tick_factor() != -1 )
             {
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ ec.clear();
+ }
                 times_.real *= chrono_detail::tick_factor();
                 times_.user *= chrono_detail::tick_factor();
                 times_.system *= chrono_detail::tick_factor();

Added: sandbox/chrono/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp 2010-12-16 01:43:17 EST (Thu, 16 Dec 2010)
@@ -0,0 +1,250 @@
+// boost process_cpu_clocks.cpp -----------------------------------------------------------//
+
+// Copyright Beman Dawes 1994, 2006, 2008
+// Copyright Vicente J. Botet Escriba 2009
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// See http://www.boost.org/libs/chrono for documentation.
+
+//--------------------------------------------------------------------------------------//
+
+#include <boost/chrono/config.hpp>
+#include <boost/chrono/process_cpu_clocks.hpp>
+#include <cassert>
+
+# include <sys/times.h>
+# include <unistd.h>
+
+
+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 = ::sysconf( _SC_CLK_TCK )) <= 0 )
+ factor = -1;
+ else
+ {
+ assert( factor <= 1000000l ); // doesn't handle large ticks
+ factor = 1000000l / factor; // compute factor
+ if ( !factor ) factor = -1;
+ }
+ }
+ return factor;
+ }
+}
+
+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
+ {
+ 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 )
+ {
+ 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();
+ }
+ }
+ }
+}
+
+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
+ {
+ ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
+ return time_point();
+ }
+ }
+ else
+ {
+ if ( chrono_detail::tick_factor() != -1 )
+ {
+ 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();
+ }
+ }
+ }
+}
+
+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
+ {
+ ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
+ return time_point();
+ }
+ }
+ else
+ {
+ if ( chrono_detail::tick_factor() != -1 )
+ {
+ 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();
+ }
+ }
+ }
+}
+
+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
+ {
+ 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();
+ }
+ }
+ }
+
+}
+
+} }

Modified: sandbox/chrono/boost/chrono/detail/inlined/process_cpu_clocks.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/detail/inlined/process_cpu_clocks.hpp (original)
+++ sandbox/chrono/boost/chrono/detail/inlined/process_cpu_clocks.hpp 2010-12-16 01:43:17 EST (Thu, 16 Dec 2010)
@@ -15,8 +15,29 @@
 #include <boost/chrono/config.hpp>
 #include <boost/version.hpp>
 #include <boost/chrono/process_cpu_clocks.hpp>
-#include <boost/chrono/process_times.hpp>
+#include <boost/throw_exception.hpp>
+#include <boost/system/system_error.hpp>
 
+//----------------------------------------------------------------------------//
+// Windows //
+//----------------------------------------------------------------------------//
+#if defined(BOOST_CHRONO_WINDOWS_API)
+#include <boost/chrono/detail/inlined/win/process_cpu_clocks.hpp>
+
+//----------------------------------------------------------------------------//
+// Mac //
+//----------------------------------------------------------------------------//
+#elif defined(BOOST_CHRONO_MAC_API)
+#include <boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp>
+
+//----------------------------------------------------------------------------//
+// POSIX //
+//----------------------------------------------------------------------------//
+#elif defined(BOOST_CHRONO_POSIX_API)
+#include <boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp>
+
+#endif // POSIX
+#if 0
 namespace boost { namespace chrono {
 
     process_real_cpu_clock::time_point process_real_cpu_clock::now(
@@ -54,6 +75,6 @@
 
 } // namespace chrono
 } // namespace boost
-
+#endif
 
 #endif

Added: sandbox/chrono/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp 2010-12-16 01:43:17 EST (Thu, 16 Dec 2010)
@@ -0,0 +1,191 @@
+// boost process_timer.cpp -----------------------------------------------------------//
+
+// Copyright Beman Dawes 1994, 2006, 2008
+// Copyright 2009-2010 Vicente J. Botet Escriba
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// See http://www.boost.org/libs/chrono for documentation.
+
+//--------------------------------------------------------------------------------------//
+#ifndef BOOST_CHRONO_DETAIL_INLINED_WIN_PROCESS_CLOCK_HPP
+#define BOOST_CHRONO_DETAIL_INLINED_WIN_PROCESS_CLOCK_HPP
+
+#include <boost/chrono/config.hpp>
+#include <boost/chrono/system_clocks.hpp>
+#include <boost/chrono/process_cpu_clocks.hpp>
+#include <cassert>
+
+#include <boost/detail/win/GetLastError.hpp>
+#include <boost/detail/win/GetCurrentProcess.hpp>
+#include <boost/detail/win/GetProcessTimes.hpp>
+
+namespace boost
+{
+namespace chrono
+{
+
+process_real_cpu_clock::time_point process_real_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;
+
+ 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(monotonic_clock::now().time_since_epoch());
+ }
+ 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();
+ }
+ }
+
+}
+process_user_cpu_clock::time_point process_user_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;
+
+ 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(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_user_cpu_clock" ));
+ }
+ else
+ {
+ ec.assign( cause, BOOST_CHRONO_SYSTEM_CATEGORY );
+ return time_point();
+ }
+ }
+
+}
+process_system_cpu_clock::time_point process_system_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;
+
+ 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(duration(
+ ((static_cast<process_system_cpu_clock::rep>(system_time.dwHighDateTime) << 32)
+ | system_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_system_cpu_clock" ));
+ }
+ else
+ {
+ ec.assign( cause, BOOST_CHRONO_SYSTEM_CATEGORY );
+ return time_point();
+ }
+ }
+
+}
+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;
+
+ if ( boost::detail::win32::GetProcessTimes(
+ boost::detail::win32::GetCurrentProcess(), &creation, &exit,
+ &system_time, &user_time ) )
+ {
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ ec.clear();
+ }
+ time_point::rep r(
+ monotonic_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::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_cpu_clock" ));
+ }
+ else
+ {
+ ec.assign( cause, BOOST_CHRONO_SYSTEM_CATEGORY );
+ return time_point();
+ }
+ }
+
+}
+} // namespace chrono
+} // namespace boost
+
+#endif

Modified: sandbox/chrono/boost/chrono/duration.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/duration.hpp (original)
+++ sandbox/chrono/boost/chrono/duration.hpp 2010-12-16 01:43:17 EST (Thu, 16 Dec 2010)
@@ -417,9 +417,11 @@
         rep rep_;
     public:
 
- BOOST_CHRONO_CONSTEXPR duration() { } // = default;
+ BOOST_CHRONO_CONSTEXPR
+ duration() { } ;
         template <class Rep2>
- BOOST_CHRONO_CONSTEXPR explicit duration(const Rep2& r,
+ BOOST_CHRONO_CONSTEXPR
+ explicit duration(const Rep2& r,
             typename boost::enable_if <
                     mpl::and_ <
                         boost::is_convertible<Rep2, rep>,
@@ -443,7 +445,8 @@
 
         // conversions
         template <class Rep2, class Period2>
- BOOST_CHRONO_CONSTEXPR duration(const duration<Rep2, Period2>& d,
+ BOOST_CHRONO_CONSTEXPR
+ duration(const duration<Rep2, Period2>& d,
             typename boost::enable_if <
                     mpl::or_ <
                         treat_as_floating_point<rep>,
@@ -466,11 +469,14 @@
 
         // observer
 
- BOOST_CHRONO_CONSTEXPR rep count() const {return rep_;}
+ BOOST_CHRONO_CONSTEXPR
+ rep count() const {return rep_;}
 
         // arithmetic
 
+ BOOST_CHRONO_CONSTEXPR
         duration operator+() const {return *this;}
+ BOOST_CHRONO_CONSTEXPR
         duration operator-() const {return duration(-rep_);}
         duration& operator++() {++rep_; return *this;}
         duration operator++(int) {return duration(rep_++);}
@@ -690,7 +696,7 @@
     // Duration ==
 
     template <class Rep1, class Period1, class Rep2, class Period2>
- inline
+ inline BOOST_CHRONO_CONSTEXPR
     bool
     operator==(const duration<Rep1, Period1>& lhs,
           const duration<Rep2, Period2>& rhs)
@@ -702,7 +708,7 @@
     // Duration !=
 
     template <class Rep1, class Period1, class Rep2, class Period2>
- inline
+ inline BOOST_CHRONO_CONSTEXPR
     bool
     operator!=(const duration<Rep1, Period1>& lhs,
           const duration<Rep2, Period2>& rhs)
@@ -713,7 +719,7 @@
     // Duration <
 
     template <class Rep1, class Period1, class Rep2, class Period2>
- inline
+ inline BOOST_CHRONO_CONSTEXPR
     bool
     operator< (const duration<Rep1, Period1>& lhs,
           const duration<Rep2, Period2>& rhs)
@@ -725,7 +731,7 @@
     // Duration >
 
     template <class Rep1, class Period1, class Rep2, class Period2>
- inline
+ inline BOOST_CHRONO_CONSTEXPR
     bool
     operator> (const duration<Rep1, Period1>& lhs,
           const duration<Rep2, Period2>& rhs)
@@ -736,7 +742,7 @@
     // Duration <=
 
     template <class Rep1, class Period1, class Rep2, class Period2>
- inline
+ inline BOOST_CHRONO_CONSTEXPR
     bool
     operator<=(const duration<Rep1, Period1>& lhs,
           const duration<Rep2, Period2>& rhs)
@@ -761,7 +767,7 @@
 
     // Compile-time select the most efficient algorithm for the conversion...
     template <class ToDuration, class Rep, class Period>
- inline
+ inline BOOST_CHRONO_CONSTEXPR
     typename boost::enable_if <
       boost::chrono::detail::is_duration<ToDuration>, ToDuration>::type
     duration_cast(const duration<Rep, Period>& fd)

Modified: sandbox/chrono/boost/chrono/process_cpu_clocks.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/process_cpu_clocks.hpp (original)
+++ sandbox/chrono/boost/chrono/process_cpu_clocks.hpp 2010-12-16 01:43:17 EST (Thu, 16 Dec 2010)
@@ -30,7 +30,7 @@
         typedef duration::rep rep;
         typedef duration::period period;
         typedef chrono::time_point<process_real_cpu_clock> time_point;
- static const bool is_monotonic = true;
+ BOOST_CHRONO_STATIC_CONSTEXPR bool is_monotonic = true;
 
         static BOOST_CHRONO_INLINE time_point now(
                 system::error_code & ec = BOOST_CHRONO_THROWS );
@@ -42,7 +42,7 @@
         typedef duration::rep rep;
         typedef duration::period period;
         typedef chrono::time_point<process_user_cpu_clock> time_point;
- static const bool is_monotonic = true;
+ BOOST_CHRONO_STATIC_CONSTEXPR bool is_monotonic = true;
 
         static BOOST_CHRONO_INLINE time_point now(
                 system::error_code & ec = BOOST_CHRONO_THROWS );
@@ -54,7 +54,7 @@
         typedef duration::rep rep;
         typedef duration::period period;
         typedef chrono::time_point<process_system_cpu_clock> time_point;
- static const bool is_monotonic = true;
+ BOOST_CHRONO_STATIC_CONSTEXPR bool is_monotonic = true;
 
         static BOOST_CHRONO_INLINE time_point now(
                 system::error_code & ec = BOOST_CHRONO_THROWS );
@@ -178,7 +178,7 @@
         typedef duration::rep rep;
         typedef duration::period period;
         typedef chrono::time_point<process_cpu_clock> time_point;
- static const bool is_monotonic = true;
+ BOOST_CHRONO_STATIC_CONSTEXPR bool is_monotonic = true;
 
         static BOOST_CHRONO_INLINE time_point now(
                 system::error_code & ec = BOOST_CHRONO_THROWS );

Modified: sandbox/chrono/boost/chrono/process_times.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/process_times.hpp (original)
+++ sandbox/chrono/boost/chrono/process_times.hpp 2010-12-16 01:43:17 EST (Thu, 16 Dec 2010)
@@ -39,7 +39,7 @@
         typedef duration::rep rep;
         typedef duration::period period;
         typedef chrono::time_point<process_clock> time_point;
- static const bool is_monotonic = true;
+ BOOST_CHRONO_STATIC_CONSTEXPR bool is_monotonic = true;
 
         struct durations
         {

Modified: sandbox/chrono/boost/chrono/system_clocks.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/system_clocks.hpp (original)
+++ sandbox/chrono/boost/chrono/system_clocks.hpp 2010-12-16 01:43:17 EST (Thu, 16 Dec 2010)
@@ -125,7 +125,7 @@
       typedef duration::rep rep;
       typedef duration::period period;
       typedef chrono::time_point<system_clock> time_point;
- static const bool is_monotonic = false;
+ BOOST_CHRONO_STATIC_CONSTEXPR bool is_monotonic = false;
 
       static BOOST_CHRONO_INLINE time_point now(); // throws on error
       static BOOST_CHRONO_INLINE time_point now(system::error_code & ec); // never throws
@@ -149,7 +149,7 @@
       typedef duration::rep rep;
       typedef duration::period period;
       typedef chrono::time_point<monotonic_clock> time_point;
- static const bool is_monotonic = true;
+ BOOST_CHRONO_STATIC_CONSTEXPR bool is_monotonic = true;
 
       static BOOST_CHRONO_INLINE time_point now(); // throws on error
       static BOOST_CHRONO_INLINE time_point now(system::error_code & ec); // never throws

Modified: sandbox/chrono/boost/chrono/thread_clock.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/thread_clock.hpp (original)
+++ sandbox/chrono/boost/chrono/thread_clock.hpp 2010-12-16 01:43:17 EST (Thu, 16 Dec 2010)
@@ -30,7 +30,7 @@
     typedef duration::rep rep;
     typedef duration::period period;
     typedef chrono::time_point<thread_clock> time_point;
- static const bool is_monotonic = BOOST_CHRONO_THREAD_CLOCK_IS_MONOTONIC;
+ BOOST_CHRONO_STATIC_CONSTEXPR bool is_monotonic = BOOST_CHRONO_THREAD_CLOCK_IS_MONOTONIC;
 
     static BOOST_CHRONO_INLINE time_point now( );
     static BOOST_CHRONO_INLINE time_point now( system::error_code & ec );

Modified: sandbox/chrono/boost/chrono/time_point.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/time_point.hpp (original)
+++ sandbox/chrono/boost/chrono/time_point.hpp 2010-12-16 01:43:17 EST (Thu, 16 Dec 2010)
@@ -104,32 +104,39 @@
 
     // time_point comparisons
     template <class Clock, class Duration1, class Duration2>
+ inline BOOST_CHRONO_CONSTEXPR
     bool operator==(
           const time_point<Clock, Duration1>& lhs,
           const time_point<Clock, Duration2>& rhs);
     template <class Clock, class Duration1, class Duration2>
+ inline BOOST_CHRONO_CONSTEXPR
     bool operator!=(
           const time_point<Clock, Duration1>& lhs,
           const time_point<Clock, Duration2>& rhs);
     template <class Clock, class Duration1, class Duration2>
+ inline BOOST_CHRONO_CONSTEXPR
     bool operator< (
           const time_point<Clock, Duration1>& lhs,
           const time_point<Clock, Duration2>& rhs);
     template <class Clock, class Duration1, class Duration2>
+ inline BOOST_CHRONO_CONSTEXPR
     bool operator<=(
           const time_point<Clock, Duration1>& lhs,
           const time_point<Clock, Duration2>& rhs);
     template <class Clock, class Duration1, class Duration2>
+ inline BOOST_CHRONO_CONSTEXPR
     bool operator> (
           const time_point<Clock, Duration1>& lhs,
           const time_point<Clock, Duration2>& rhs);
     template <class Clock, class Duration1, class Duration2>
+ inline BOOST_CHRONO_CONSTEXPR
     bool operator>=(
           const time_point<Clock, Duration1>& lhs,
           const time_point<Clock, Duration2>& rhs);
 
     // time_point_cast
     template <class ToDuration, class Clock, class Duration>
+ inline BOOST_CHRONO_CONSTEXPR
     time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t);
 
 //----------------------------------------------------------------------------//
@@ -152,14 +159,16 @@
         duration d_;
 
     public:
+ BOOST_CHRONO_CONSTEXPR
         time_point() : d_(duration::zero())
         {}
- explicit time_point(const duration& d)
+ BOOST_CHRONO_CONSTEXPR explicit time_point(const duration& d)
               : d_(d)
         {}
 
         // conversions
         template <class Duration2>
+ BOOST_CHRONO_CONSTEXPR
         time_point(const time_point<clock, Duration2>& t,
                 typename boost::enable_if
                 <
@@ -171,6 +180,7 @@
 
         // observer
 
+ BOOST_CHRONO_CONSTEXPR
         duration time_since_epoch() const
         {
             return d_;
@@ -259,7 +269,7 @@
     // time_point ==
 
     template <class Clock, class Duration1, class Duration2>
- inline
+ inline BOOST_CHRONO_CONSTEXPR
     bool
     operator==(const time_point<Clock, Duration1>& lhs,
              const time_point<Clock, Duration2>& rhs)
@@ -270,7 +280,7 @@
     // time_point !=
 
     template <class Clock, class Duration1, class Duration2>
- inline
+ inline BOOST_CHRONO_CONSTEXPR
     bool
     operator!=(const time_point<Clock, Duration1>& lhs,
              const time_point<Clock, Duration2>& rhs)
@@ -281,7 +291,7 @@
     // time_point <
 
     template <class Clock, class Duration1, class Duration2>
- inline
+ inline BOOST_CHRONO_CONSTEXPR
     bool
     operator<(const time_point<Clock, Duration1>& lhs,
             const time_point<Clock, Duration2>& rhs)
@@ -292,7 +302,7 @@
     // time_point >
 
     template <class Clock, class Duration1, class Duration2>
- inline
+ inline BOOST_CHRONO_CONSTEXPR
     bool
     operator>(const time_point<Clock, Duration1>& lhs,
             const time_point<Clock, Duration2>& rhs)
@@ -303,7 +313,7 @@
     // time_point <=
 
     template <class Clock, class Duration1, class Duration2>
- inline
+ inline BOOST_CHRONO_CONSTEXPR
     bool
     operator<=(const time_point<Clock, Duration1>& lhs,
              const time_point<Clock, Duration2>& rhs)
@@ -314,7 +324,7 @@
     // time_point >=
 
     template <class Clock, class Duration1, class Duration2>
- inline
+ inline BOOST_CHRONO_CONSTEXPR
     bool
     operator>=(const time_point<Clock, Duration1>& lhs,
              const time_point<Clock, Duration2>& rhs)
@@ -327,7 +337,7 @@
 //----------------------------------------------------------------------------//
 
     template <class ToDuration, class Clock, class Duration>
- inline
+ inline BOOST_CHRONO_CONSTEXPR
     time_point<Clock, ToDuration>
     time_point_cast(const time_point<Clock, Duration>& t)
     {


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