Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74801 - in branches/release/boost/chrono: . detail/inlined/mac detail/inlined/posix detail/inlined/win
From: vicente.botet_at_[hidden]
Date: 2011-10-08 08:28:40


Author: viboes
Date: 2011-10-08 08:28:38 EDT (Sat, 08 Oct 2011)
New Revision: 74801
URL: http://svn.boost.org/trac/boost/changeset/74801

Log:
Chrono: Merge #5998
Added:
   branches/release/boost/chrono/clock_string.hpp (contents, props changed)
Text files modified:
   branches/release/boost/chrono/chrono_io.hpp | 138 -------------------
   branches/release/boost/chrono/config.hpp | 4
   branches/release/boost/chrono/detail/inlined/mac/chrono.hpp | 16 +
   branches/release/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp | 9 +
   branches/release/boost/chrono/detail/inlined/posix/chrono.hpp | 4
   branches/release/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp | 10 +
   branches/release/boost/chrono/detail/inlined/posix/thread_clock.hpp | 3
   branches/release/boost/chrono/detail/inlined/win/chrono.hpp | 4
   branches/release/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp | 280 ++++-----------------------------------
   branches/release/boost/chrono/detail/inlined/win/thread_clock.hpp | 2
   branches/release/boost/chrono/duration.hpp | 2
   branches/release/boost/chrono/process_cpu_clocks.hpp | 105 ++++++++++++++
   branches/release/boost/chrono/system_clocks.hpp | 58 ++++++++
   branches/release/boost/chrono/thread_clock.hpp | 30 ++++
   branches/release/boost/chrono/time_point.hpp | 2
   15 files changed, 265 insertions(+), 402 deletions(-)

Modified: branches/release/boost/chrono/chrono_io.hpp
==============================================================================
--- branches/release/boost/chrono/chrono_io.hpp (original)
+++ branches/release/boost/chrono/chrono_io.hpp 2011-10-08 08:28:38 EDT (Sat, 08 Oct 2011)
@@ -16,6 +16,7 @@
 #include <boost/chrono/chrono.hpp>
 #include <boost/chrono/process_cpu_clocks.hpp>
 #include <boost/chrono/thread_clock.hpp>
+#include <boost/chrono/clock_string.hpp>
 #include <boost/ratio/ratio_io.hpp>
 #include <locale>
 #include <boost/type_traits/is_scalar.hpp>
@@ -471,143 +472,6 @@
     return is;
 }
 
-template <class Clock, class CharT>
-struct clock_string;
-
-template <class CharT>
-struct clock_string<system_clock, CharT>
-{
- static std::basic_string<CharT> name()
- {
- static const CharT u[] = {'s', 'y', 's', 't', 'e', 'm', '_',
- 'c', 'l','o', 'c', 'k'};
- static const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
- return str;
- }
- static std::basic_string<CharT> since()
- {
- static const CharT u[] = {' ', 's', 'i', 'n', 'c', 'e', ' ', 'J', 'a',
- 'n', ' ', '1', ',', ' ', '1', '9', '7', '0'};
- static const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
- return str;
- }
-};
-#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
-
-template <class CharT>
-struct clock_string<steady_clock, CharT>
-{
- static std::basic_string<CharT> name()
- {
- static const CharT u[] = {'m', 'o', 'n', 'o', 't', 'o', 'n', 'i', 'c', '_',
- 'c', 'l','o', 'c', 'k'};
- static const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
- return str;
- }
- static std::basic_string<CharT> since()
- {
- const CharT u[] = {' ', 's', 'i', 'n', 'c', 'e', ' ', 'b', 'o', 'o', 't'};
- const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
- return str;
- }
-};
-
-
-#endif
-
-#if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
-
-template <class CharT>
-struct clock_string<thread_clock, CharT>
-{
- static std::basic_string<CharT> name()
- {
- static const CharT u[] = {'t', 'h', 'r', 'e', 'd', '_',
- 'c', 'l','o', 'c', 'k'};
- static const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
- return str;
- }
- static std::basic_string<CharT> since()
- {
- const CharT u[] = {' ', 's', 'i', 'n', 'c', 'e', ' ', 't', 'r', 'e', 'a', 'd', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p'};
- const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
- return str;
- }
-};
-
-#endif
-
-template <class CharT>
-struct clock_string<process_real_cpu_clock, CharT>
-{
- static std::basic_string<CharT> name()
- {
- static const CharT u[] = {'p', 'r', 'o', 'c', 'e', 's', 's', '_', 'r', 'e', 'a', 'l','_',
- 'c', 'l','o', 'c', 'k'};
- static const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
- return str;
- }
- static std::basic_string<CharT> since()
- {
- const CharT u[] = {' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p'};
- const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
- return str;
- }
-};
-
-template <class CharT>
-struct clock_string<process_user_cpu_clock, CharT>
-{
- static std::basic_string<CharT> name()
- {
- static const CharT u[] = {'p', 'r', 'o', 'c', 'e', 's', 's', '_', 'u', 's', 'e', 'r','_',
- 'c', 'l','o', 'c', 'k'};
- static const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
- return str;
- }
- static std::basic_string<CharT> since()
- {
- const CharT u[] = {' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p'};
- const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
- return str;
- }
-};
-
-template <class CharT>
-struct clock_string<process_system_cpu_clock, CharT>
-{
- static std::basic_string<CharT> name()
- {
- static const CharT u[] = {'p', 'r', 'o', 'c', 'e', 's', 's', '_', 's', 'y', 's', 't', 't', 'e', 'm', '_',
- 'c', 'l','o', 'c', 'k'};
- static const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
- return str;
- }
- static std::basic_string<CharT> since()
- {
- const CharT u[] = {' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p'};
- const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
- return str;
- }
-};
-
-template <class CharT>
-struct clock_string<process_cpu_clock, CharT>
-{
- static std::basic_string<CharT> name()
- {
- static const CharT u[] = {'p', 'r', 'o', 'c', 'e', 's', 's', '_',
- 'c', 'l','o', 'c', 'k'};
- static const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
- return str;
- }
- static std::basic_string<CharT> since()
- {
- const CharT u[] = {' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p'};
- const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
- return str;
- }
-};
 
 template <class CharT, class Traits, class Clock, class Duration>
 std::basic_ostream<CharT, Traits>&

Added: branches/release/boost/chrono/clock_string.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/chrono/clock_string.hpp 2011-10-08 08:28:38 EDT (Sat, 08 Oct 2011)
@@ -0,0 +1,25 @@
+//
+// (C) Copyright 2010-2011 Vicente J. Botet Escriba
+// Use, modification and distribution are subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt).
+//
+
+#ifndef BOOST_CHRONO_CLOCK_STRING_HPP
+#define BOOST_CHRONO_CLOCK_STRING_HPP
+
+#include <string>
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ template<class Clock, class CharT>
+ struct clock_string;
+
+ } // chrono
+
+} // boost
+
+#endif // BOOST_CHRONO_CLOCK_STRING_HPP

Modified: branches/release/boost/chrono/config.hpp
==============================================================================
--- branches/release/boost/chrono/config.hpp (original)
+++ branches/release/boost/chrono/config.hpp 2011-10-08 08:28:38 EDT (Sat, 08 Oct 2011)
@@ -1,7 +1,7 @@
 // boost/chrono/config.hpp -------------------------------------------------//
 
 // Copyright Beman Dawes 2003, 2006, 2008
-// Copyright 2009 Vicente J. Botet Escriba
+// Copyright 2009-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)
@@ -148,6 +148,8 @@
 #endif
 
 
+//#define BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+
 // enable automatic library variant selection ------------------------------//
 
 #if !defined(BOOST_CHRONO_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_CHRONO_NO_LIB)

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-08 08:28:38 EDT (Sat, 08 Oct 2011)
@@ -33,6 +33,7 @@
     return time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec));
 }
 
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
 system_clock::time_point
 system_clock::now(system::error_code & ec)
 {
@@ -44,7 +45,7 @@
     }
     return time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec));
 }
-
+#endif
 // Take advantage of the fact that on this platform time_t is nothing but
 // an integral count of seconds since New Years 1970 (same epoch as timeval).
 // Just get the duration out of the time_point and truncate it to seconds.
@@ -82,6 +83,7 @@
     return mach_absolute_time();
 }
 
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
 BOOST_CHRONO_STATIC
 steady_clock::rep
 steady_simplified_ec(system::error_code & ec)
@@ -92,7 +94,7 @@
     }
     return mach_absolute_time();
 }
-
+#endif
 
 BOOST_CHRONO_STATIC
 double
@@ -119,6 +121,7 @@
     return static_cast<steady_clock::rep>(mach_absolute_time() * factor);
 }
 
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
 BOOST_CHRONO_STATIC
 steady_clock::rep
 steady_full_ec(system::error_code & ec)
@@ -147,10 +150,12 @@
     }
     return static_cast<steady_clock::rep>(mach_absolute_time() * factor);
 }
+#endif
 
 typedef steady_clock::rep (*FP)();
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
 typedef steady_clock::rep (*FP_ec)(system::error_code &);
-
+#endif
 
 BOOST_CHRONO_STATIC
 FP
@@ -170,6 +175,7 @@
     return &chrono_detail::steady_full;
 }
 
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
 BOOST_CHRONO_STATIC
 FP_ec
 init_steady_clock_ec(kern_return_t & err)
@@ -187,6 +193,7 @@
     }
     return &chrono_detail::steady_full_ec;
 }
+#endif
 }
 
 steady_clock::time_point
@@ -201,6 +208,7 @@
     return time_point(duration(fp()));
 }
 
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
 steady_clock::time_point
 steady_clock::now(system::error_code & ec)
 {
@@ -228,6 +236,6 @@
     }
     return time_point(duration(fp(ec)));
 }
-
+#endif
 } // namespace chrono
 } // namespace boost

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-08 08:28:38 EDT (Sat, 08 Oct 2011)
@@ -78,6 +78,7 @@
 #endif
     }
 
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
     process_real_cpu_clock::time_point process_real_cpu_clock::now(system::error_code & ec)
     {
 
@@ -136,7 +137,9 @@
 #endif
 
     }
+#endif
 
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
     process_user_cpu_clock::time_point process_user_cpu_clock::now(system::error_code & ec)
     {
       tms tm;
@@ -174,6 +177,7 @@
         }
       }
     }
+#endif
 
     process_user_cpu_clock::time_point process_user_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
     {
@@ -218,6 +222,7 @@
       return time_point();
     }
 
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
     process_system_cpu_clock::time_point process_system_cpu_clock::now(system::error_code & ec)
     {
       tms tm;
@@ -255,6 +260,7 @@
         }
       }
     }
+#endif
 
     process_cpu_clock::time_point process_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
     {
@@ -280,6 +286,7 @@
       return time_point();
     }
 
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
     process_cpu_clock::time_point process_cpu_clock::now(system::error_code & ec)
     {
 
@@ -318,5 +325,7 @@
       }
 
     }
+#endif
+
   }
 }

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-08 08:28:38 EDT (Sat, 08 Oct 2011)
@@ -29,6 +29,7 @@
       static_cast<system_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
   }
 
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
   system_clock::time_point system_clock::now(system::error_code & ec)
   {
     timespec ts;
@@ -56,6 +57,7 @@
     return time_point(duration(
       static_cast<system_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
   }
+#endif
 
   std::time_t system_clock::to_time_t(const system_clock::time_point& t) BOOST_CHRONO_NOEXCEPT
   {
@@ -81,6 +83,7 @@
       static_cast<steady_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
   }
 
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
   steady_clock::time_point steady_clock::now(system::error_code & ec)
   {
     timespec ts;
@@ -109,6 +112,7 @@
       static_cast<steady_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
   }
 #endif
+#endif
 
 } // namespace chrono
 } // namespace boost

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-08 08:28:38 EDT (Sat, 08 Oct 2011)
@@ -63,6 +63,8 @@
     }
     return time_point();
 }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
 process_real_cpu_clock::time_point process_real_cpu_clock::now(
         system::error_code & ec)
 {
@@ -114,6 +116,7 @@
         }
     }
 }
+#endif
 
 process_user_cpu_clock::time_point process_user_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
 {
@@ -138,6 +141,7 @@
     return time_point();
 }
 
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
 process_user_cpu_clock::time_point process_user_cpu_clock::now(
         system::error_code & ec)
 {
@@ -188,6 +192,7 @@
         }
     }
 }
+#endif
 
 process_system_cpu_clock::time_point process_system_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
 {
@@ -212,6 +217,7 @@
     }
 }
 
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
 process_system_cpu_clock::time_point process_system_cpu_clock::now(
         system::error_code & ec)
 {
@@ -262,6 +268,7 @@
         }
     }
 }
+#endif
 
 process_cpu_clock::time_point process_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
 {
@@ -288,6 +295,8 @@
     }
     return time_point();
 }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
 process_cpu_clock::time_point process_cpu_clock::now(
         system::error_code & ec )
 {
@@ -338,5 +347,6 @@
     }
     
 }
+#endif
 
 } }

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-08 08:28:38 EDT (Sat, 08 Oct 2011)
@@ -43,6 +43,8 @@
             static_cast<thread_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
 
     }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
     thread_clock::time_point thread_clock::now( system::error_code & ec )
     {
       struct timespec ts;
@@ -82,4 +84,5 @@
             static_cast<thread_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
 
     }
+#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-08 08:28:38 EDT (Sat, 08 Oct 2011)
@@ -49,6 +49,7 @@
   }
 
 
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
   steady_clock::time_point steady_clock::now( system::error_code & ec )
   {
     static double nanosecs_per_tic = chrono_detail::get_nanosecs_per_tic();
@@ -82,6 +83,7 @@
     return time_point(duration(
       static_cast<steady_clock::rep>(nanosecs_per_tic * pcount.QuadPart)));
   }
+#endif
 
   BOOST_CHRONO_INLINE
   system_clock::time_point system_clock::now() BOOST_CHRONO_NOEXCEPT
@@ -99,6 +101,7 @@
       (static_cast<__int64>( ft.dwHighDateTime ) << 32) | ft.dwLowDateTime));
   }
 
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
   BOOST_CHRONO_INLINE
   system_clock::time_point system_clock::now( system::error_code & ec )
   {
@@ -118,6 +121,7 @@
     return time_point(duration(
       (static_cast<__int64>( ft.dwHighDateTime ) << 32) | ft.dwLowDateTime));
   }
+#endif
 
   BOOST_CHRONO_INLINE
   std::time_t system_clock::to_time_t(const system_clock::time_point& t) BOOST_CHRONO_NOEXCEPT

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-08 08:28:38 EDT (Sat, 08 Oct 2011)
@@ -1,6 +1,5 @@
-// boost process_timer.cpp -----------------------------------------------------------//
+// boost process_cpu_clocks.cpp -----------------------------------------------------------//
 
-// Copyright Beman Dawes 1994, 2006, 2008
 // Copyright 2009-2010 Vicente J. Botet Escriba
 
 // Distributed under the Boost Software License, Version 1.0.
@@ -9,257 +8,38 @@
 // 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
+#ifndef BOOST_CHRONO_DETAIL_INLINED_PROCESS_CPU_CLOCKS_HPP
+#define BOOST_CHRONO_DETAIL_INLINED_PROCESS_CPU_CLOCKS_HPP
+
 
 #include <boost/chrono/config.hpp>
-//#include <boost/chrono/system_clocks.hpp>
+#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS)
+
+#include <boost/version.hpp>
 #include <boost/chrono/process_cpu_clocks.hpp>
-#include <cassert>
-#include <time.h>
+#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>
 
-#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() 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)
-{
- 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;
-
- if ( boost::detail::win32::GetProcessTimes(
- boost::detail::win32::GetCurrentProcess(), &creation, &exit,
- &system_time, &user_time ) )
- {
- return time_point(duration(
- ((static_cast<process_user_cpu_clock::rep>(user_time.dwHighDateTime) << 32)
- | user_time.dwLowDateTime) * 100
- ));
- }
- 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)
-{
-
- // 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() 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)
-{
-
- // 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() 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 )
-{
-
- // 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(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::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 // POSIX
+
+#endif
 
 #endif

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-08 08:28:38 EDT (Sat, 08 Oct 2011)
@@ -24,6 +24,7 @@
 namespace chrono
 {
 
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
 thread_clock::time_point thread_clock::now( system::error_code & ec )
 {
     // note that Windows uses 100 nanosecond ticks for FILETIME
@@ -65,6 +66,7 @@
         }
     }
 }
+#endif
 
 thread_clock::time_point thread_clock::now() BOOST_CHRONO_NOEXCEPT
 {

Modified: branches/release/boost/chrono/duration.hpp
==============================================================================
--- branches/release/boost/chrono/duration.hpp (original)
+++ branches/release/boost/chrono/duration.hpp 2011-10-08 08:28:38 EDT (Sat, 08 Oct 2011)
@@ -2,7 +2,7 @@
 
 // Copyright 2008 Howard Hinnant
 // Copyright 2008 Beman Dawes
-// Copyright 2009-2010 Vicente J. Botet Escriba
+// Copyright 2009-2011 Vicente J. Botet Escriba
 
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt

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-08 08:28:38 EDT (Sat, 08 Oct 2011)
@@ -1,6 +1,6 @@
 // boost/chrono/process_cpu_clocks.hpp -----------------------------------------------------------//
 
-// Copyright 2009-2010 Vicente J. Botet Escriba
+// Copyright 2009-2011 Vicente J. Botet Escriba
 
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt
@@ -16,11 +16,14 @@
 
 #include <boost/chrono/duration.hpp>
 #include <boost/chrono/time_point.hpp>
-#include <boost/system/error_code.hpp>
 #include <boost/operators.hpp>
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+#include <boost/system/error_code.hpp>
 #include <boost/chrono/detail/system.hpp>
+#endif
 #include <iostream>
 #include <boost/type_traits/common_type.hpp>
+#include <boost/chrono/clock_string.hpp>
 
 
 #ifndef BOOST_CHRONO_HEADER_ONLY
@@ -38,7 +41,9 @@
         BOOST_CHRONO_STATIC_CONSTEXPR bool is_steady = true;
 
         static BOOST_CHRONO_INLINE time_point now() BOOST_CHRONO_NOEXCEPT;
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
         static BOOST_CHRONO_INLINE time_point now(system::error_code & ec );
+#endif
     };
 
     class BOOST_CHRONO_DECL process_user_cpu_clock {
@@ -50,7 +55,9 @@
         BOOST_CHRONO_STATIC_CONSTEXPR bool is_steady = true;
 
         static BOOST_CHRONO_INLINE time_point now() BOOST_CHRONO_NOEXCEPT;
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
         static BOOST_CHRONO_INLINE time_point now(system::error_code & ec );
+#endif
     };
 
     class BOOST_CHRONO_DECL process_system_cpu_clock {
@@ -62,7 +69,9 @@
         BOOST_CHRONO_STATIC_CONSTEXPR bool is_steady = true;
 
         static BOOST_CHRONO_INLINE time_point now() BOOST_CHRONO_NOEXCEPT;
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
         static BOOST_CHRONO_INLINE time_point now(system::error_code & ec );
+#endif
     };
 
         template <typename Rep>
@@ -298,8 +307,9 @@
         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 );
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ static BOOST_CHRONO_INLINE time_point now(system::error_code & ec );
+#endif
     };
 
     template <class CharT, class Traits, typename Rep>
@@ -343,6 +353,93 @@
         }
     };
 
+ template<class CharT>
+ struct clock_string<process_real_cpu_clock, CharT>
+ {
+ static std::basic_string<CharT> name()
+ {
+ static const CharT
+ u[] =
+ { 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 'r', 'e', 'a', 'l', '_', 'c', 'l', 'o', 'c', 'k' };
+ static const std::basic_string<CharT> str(u, u + sizeof(u)
+ / sizeof(u[0]));
+ return str;
+ }
+ static std::basic_string<CharT> since()
+ {
+ const CharT
+ u[] =
+ { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p' };
+ const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
+ return str;
+ }
+ };
+
+ template<class CharT>
+ struct clock_string<process_user_cpu_clock, CharT>
+ {
+ static std::basic_string<CharT> name()
+ {
+ static const CharT
+ u[] =
+ { 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 'u', 's', 'e', 'r', '_', 'c', 'l', 'o', 'c', 'k' };
+ static const std::basic_string<CharT> str(u, u + sizeof(u)
+ / sizeof(u[0]));
+ return str;
+ }
+ static std::basic_string<CharT> since()
+ {
+ const CharT
+ u[] =
+ { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p' };
+ const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
+ return str;
+ }
+ };
+
+ template<class CharT>
+ struct clock_string<process_system_cpu_clock, CharT>
+ {
+ static std::basic_string<CharT> name()
+ {
+ static const CharT
+ u[] =
+ { 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 's', 'y', 's', 't', 't', 'e', 'm', '_', 'c', 'l', 'o', 'c', 'k' };
+ static const std::basic_string<CharT> str(u, u + sizeof(u)
+ / sizeof(u[0]));
+ return str;
+ }
+ static std::basic_string<CharT> since()
+ {
+ const CharT
+ u[] =
+ { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p' };
+ const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
+ return str;
+ }
+ };
+
+ template<class CharT>
+ struct clock_string<process_cpu_clock, CharT>
+ {
+ static std::basic_string<CharT> name()
+ {
+ static const CharT u[] =
+ { 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 'c', 'l', 'o', 'c', 'k' };
+ static const std::basic_string<CharT> str(u, u + sizeof(u)
+ / sizeof(u[0]));
+ return str;
+ }
+ static std::basic_string<CharT> since()
+ {
+ const CharT
+ u[] =
+ { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'p', 'r', 'o', 'c', 'e', 's', 's', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p' };
+ const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
+ return str;
+ }
+ };
+
 } // namespace chrono
 } // namespace boost
 

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-08 08:28:38 EDT (Sat, 08 Oct 2011)
@@ -1,8 +1,8 @@
-// chrono.hpp --------------------------------------------------------------//
+// boost/chrono/system_clocks.hpp --------------------------------------------------------------//
 
 // Copyright 2008 Howard Hinnant
 // Copyright 2008 Beman Dawes
-// Copyright 2009-2010 Vicente J. Botet Escriba
+// Copyright 2009-2011 Vicente J. Botet Escriba
 
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt
@@ -62,8 +62,11 @@
 #include <boost/chrono/config.hpp>
 #include <boost/chrono/duration.hpp>
 #include <boost/chrono/time_point.hpp>
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
 #include <boost/chrono/detail/system.hpp>
 #include <boost/system/error_code.hpp>
+#endif
+#include <boost/chrono/clock_string.hpp>
 
 #include <ctime>
 
@@ -128,7 +131,9 @@
       BOOST_CHRONO_STATIC_CONSTEXPR bool is_steady = false;
 
       static BOOST_CHRONO_INLINE time_point now() BOOST_CHRONO_NOEXCEPT;
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
       static BOOST_CHRONO_INLINE time_point now(system::error_code & ec);
+#endif
 
       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;
@@ -152,7 +157,9 @@
       BOOST_CHRONO_STATIC_CONSTEXPR bool is_steady = true;
 
       static BOOST_CHRONO_INLINE time_point now() BOOST_CHRONO_NOEXCEPT;
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
       static BOOST_CHRONO_INLINE time_point now(system::error_code & ec);
+#endif
   };
 #endif
 //----------------------------------------------------------------------------//
@@ -163,6 +170,53 @@
 // See synopsis.
 
 
+ template<class CharT>
+ struct clock_string<system_clock, CharT>
+ {
+ static std::basic_string<CharT> name()
+ {
+ static const CharT u[] =
+ { 's', 'y', 's', 't', 'e', 'm', '_', 'c', 'l', 'o', 'c', 'k' };
+ static const std::basic_string<CharT> str(u, u + sizeof(u)
+ / sizeof(u[0]));
+ return str;
+ }
+ static std::basic_string<CharT> since()
+ {
+ static const CharT
+ u[] =
+ { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'J', 'a', 'n', ' ', '1', ',', ' ', '1', '9', '7', '0' };
+ static const std::basic_string<CharT> str(u, u + sizeof(u)
+ / sizeof(u[0]));
+ return str;
+ }
+ };
+
+#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
+
+ template<class CharT>
+ struct clock_string<steady_clock, CharT>
+ {
+ static std::basic_string<CharT> name()
+ {
+ static const CharT
+ u[] =
+ { 's', 't', 'e', 'a', 'd', 'y', '_', 'c', 'l', 'o', 'c', 'k' };
+ static const std::basic_string<CharT> str(u, u + sizeof(u)
+ / sizeof(u[0]));
+ return str;
+ }
+ static std::basic_string<CharT> since()
+ {
+ const CharT u[] =
+ { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'b', 'o', 'o', 't' };
+ const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0]));
+ return str;
+ }
+ };
+
+#endif
+
 } // namespace chrono
 } // namespace boost
 

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-08 08:28:38 EDT (Sat, 08 Oct 2011)
@@ -1,6 +1,6 @@
-// boost/chrono/process_cpu_clocks.hpp -----------------------------------------------------------//
+// boost/chrono/thread_clock.hpp -----------------------------------------------------------//
 
-// Copyright 2009-2010 Vicente J. Botet Escriba
+// Copyright 2009-2011 Vicente J. Botet Escriba
 
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt
@@ -15,8 +15,11 @@
 #include <boost/chrono/config.hpp>
 #include <boost/chrono/duration.hpp>
 #include <boost/chrono/time_point.hpp>
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
 #include <boost/system/error_code.hpp>
 #include <boost/chrono/detail/system.hpp>
+#endif
+#include <boost/chrono/clock_string.hpp>
 
 #ifndef BOOST_CHRONO_HEADER_ONLY
 #include <boost/config/abi_prefix.hpp> // must be the last #include
@@ -33,8 +36,31 @@
     BOOST_CHRONO_STATIC_CONSTEXPR bool is_steady = BOOST_CHRONO_THREAD_CLOCK_IS_STEADY;
 
     static BOOST_CHRONO_INLINE time_point now( ) BOOST_CHRONO_NOEXCEPT;
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
     static BOOST_CHRONO_INLINE time_point now( system::error_code & ec );
+#endif
 };
+
+template <class CharT>
+struct clock_string<thread_clock, CharT>
+{
+ static std::basic_string<CharT> name()
+ {
+ static const CharT u[] =
+ { 't', 'h', 'r', 'e', 'd', '_',
+ 'c', 'l','o', 'c', 'k'};
+ static const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
+ return str;
+ }
+ static std::basic_string<CharT> since()
+ {
+ const CharT u[] =
+ { ' ', 's', 'i', 'n', 'c', 'e', ' ', 't', 'r', 'e', 'a', 'd', ' ', 's', 't', 'a', 'r', 't', '-', 'u', 'p'};
+ const std::basic_string<CharT> str(u, u + sizeof(u)/sizeof(u[0]));
+ return str;
+ }
+};
+
 } // namespace chrono
 } // namespace boost
 

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-08 08:28:38 EDT (Sat, 08 Oct 2011)
@@ -2,7 +2,7 @@
 
 // Copyright 2008 Howard Hinnant
 // Copyright 2008 Beman Dawes
-// Copyright 2009-2010 Vicente J. Botet Escriba
+// Copyright 2009-2011 Vicente J. Botet Escriba
 
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt


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