$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r74668 - trunk/boost/chrono/detail/inlined/mac
From: vicente.botet_at_[hidden]
Date: 2011-10-03 10:48:08
Author: viboes
Date: 2011-10-03 10:48:07 EDT (Mon, 03 Oct 2011)
New Revision: 74668
URL: http://svn.boost.org/trac/boost/changeset/74668
Log:
Chrono: process real cpu clock uses clock instead of times which is twice faster and with high resolution for MacOs
Text files modified: 
   trunk/boost/chrono/detail/inlined/mac/chrono.hpp             |     3 +--                                     
   trunk/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp |    33 ++++++++++++++++++++++++++++++++-       
   2 files changed, 33 insertions(+), 3 deletions(-)
Modified: trunk/boost/chrono/detail/inlined/mac/chrono.hpp
==============================================================================
--- trunk/boost/chrono/detail/inlined/mac/chrono.hpp	(original)
+++ trunk/boost/chrono/detail/inlined/mac/chrono.hpp	2011-10-03 10:48:07 EDT (Mon, 03 Oct 2011)
@@ -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);
 }
Modified: trunk/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp
==============================================================================
--- trunk/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp	(original)
+++ trunk/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp	2011-10-03 10:48:07 EDT (Mon, 03 Oct 2011)
@@ -45,9 +45,10 @@
       }
     }
 
+
     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
@@ -65,11 +66,22 @@
         }
       }
       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
@@ -104,6 +116,25 @@
           }
         }
       }
+#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
+        {
+          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)