$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r64838 - sandbox/chrono/boost/chrono
From: vicente.botet_at_[hidden]
Date: 2010-08-15 17:43:54
Author: viboes
Date: 2010-08-15 17:43:53 EDT (Sun, 15 Aug 2010)
New Revision: 64838
URL: http://svn.boost.org/trac/boost/changeset/64838
Log:
Towards making process_cpu_clock::times an arithmetic type so process_cpu_clock can be a Clcok
Text files modified: 
   sandbox/chrono/boost/chrono/process_cpu_clocks.hpp |    28 ++++++++++++++++++++++++++--            
   sandbox/chrono/boost/chrono/stopclock.hpp          |     4 ++--                                    
   2 files changed, 28 insertions(+), 4 deletions(-)
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-08-15 17:43:53 EDT (Sun, 15 Aug 2010)
@@ -54,8 +54,9 @@
     class BOOST_CHRONO_DECL process_cpu_clock
     {
     public:
-        struct times : arithmetic<times>, less_than_comparable<times>
+        struct times : arithmetic<times, multiplicative<times, process_real_cpu_clock::rep, less_than_comparable<times> > >
         {
+            typedef process_real_cpu_clock::rep rep;
             times()
                 : real(0)
                 , user(0)
@@ -96,20 +97,37 @@
                 system*=rhs.system;
                 return *this;
             }
+            times operator*=(rep const& rhs) {
+                real*=rhs;
+                user*=rhs;
+                system*=rhs;
+                return *this;
+            }
             times operator/=(times const& rhs) {
                 real/=rhs.real;
                 user/=rhs.user;
                 system/=rhs.system;
                 return *this;
             }
+            times operator/=(rep const& rhs) {
+                real/=rhs;
+                user/=rhs;
+                system/=rhs;
+                return *this;
+            }
             bool operator<(times const & rhs) const {
                 if (real < rhs.real) return true;
                 if (real > rhs.real) return false;
                 if (user < rhs.user) return true;
                 if (user > rhs.user) return false;
-                if (user < rhs.user) return true;
+                if (system < rhs.system) return true;
                 else return false;
             }
+            
+            template <typename OSTREAM>
+            void print(OSTREAM& os) {
+                os <<  "{"<< real <<","<< user <<","<< system << "}";
+            };
         };
 
         typedef boost::chrono::duration<times,  nano>                duration;
@@ -121,6 +139,12 @@
         static time_point now( system::error_code & ec = system::throws );
     };
 
+    template <typename OSTREAM>
+    OSTREAM& operator<<(OSTREAM& os, process_cpu_clock::times const& rhs) {
+        rhs.print(os);
+        return os;
+    }
+    
     template <>
     struct duration_values<process_cpu_clock::times>
     {
Modified: sandbox/chrono/boost/chrono/stopclock.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/stopclock.hpp	(original)
+++ sandbox/chrono/boost/chrono/stopclock.hpp	2010-08-15 17:43:53 EDT (Sun, 15 Aug 2010)
@@ -176,7 +176,7 @@
     typedef stopclock< boost::chrono::process_real_cpu_clock > process_real_cpu_stopclock;
     typedef stopclock< boost::chrono::process_user_cpu_clock > process_user_cpu_stopclock;
     typedef stopclock< boost::chrono::process_system_cpu_clock > process_system_cpu_stopclock;
-    //typedef stopclock< boost::chrono::process_cpu_clock > process_cpu_stopclock;
+    typedef stopclock< boost::chrono::process_cpu_clock > process_cpu_stopclock;
 
     template <class Clock=process_cpu_clock, class Formatter=typename wstopwatch_reporter_default_formatter<stopwatch<Clock> >::type>
     class wstopclock;
@@ -250,7 +250,7 @@
     typedef wstopclock< boost::chrono::process_real_cpu_clock > process_real_cpu_wstopclock;
     typedef wstopclock< boost::chrono::process_user_cpu_clock > process_user_cpu_wstopclock;
     typedef wstopclock< boost::chrono::process_system_cpu_clock > process_system_cpu_wstopclock;
-    //typedef wstopclock< boost::chrono::process_cpu_clock > process_cpu_wstopclock;
+    typedef wstopclock< boost::chrono::process_cpu_clock > process_cpu_wstopclock;
 
 
   } // namespace chrono