Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63254 - in sandbox/chrono/libs/chrono/src: . mac posix win
From: vicente.botet_at_[hidden]
Date: 2010-06-22 18:27:53


Author: viboes
Date: 2010-06-22 18:27:52 EDT (Tue, 22 Jun 2010)
New Revision: 63254
URL: http://svn.boost.org/trac/boost/changeset/63254

Log:
* error_code clear when succeeds

Text files modified:
   sandbox/chrono/libs/chrono/src/mac/chrono.cpp | 7 +++++--
   sandbox/chrono/libs/chrono/src/mac/process_clock.cpp | 7 ++++---
   sandbox/chrono/libs/chrono/src/posix/process_clock.cpp | 4 ++--
   sandbox/chrono/libs/chrono/src/run_timer.cpp | 6 ++++--
   sandbox/chrono/libs/chrono/src/win/process_clock.cpp | 1 +
   5 files changed, 16 insertions(+), 9 deletions(-)

Modified: sandbox/chrono/libs/chrono/src/mac/chrono.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/src/mac/chrono.cpp (original)
+++ sandbox/chrono/libs/chrono/src/mac/chrono.cpp 2010-06-22 18:27:52 EDT (Tue, 22 Jun 2010)
@@ -77,8 +77,9 @@
 
 static
 monotonic_clock::rep
-monotonic_simplifie_ec(system::error_code & ec)
+monotonic_simplified_ec(system::error_code & ec)
 {
+ ec.clear();
     return mach_absolute_time();
 }
 
@@ -117,6 +118,7 @@
       ec.assign( errno, system::system_category );
       return monotonic_clock::rep();
     }
+ ec.clear();
     return static_cast<monotonic_clock::rep>(mach_absolute_time() * factor);
 }
 
@@ -171,8 +173,9 @@
     static FP_ec fp = init_monotonic_clock(err);
     if( err != 0 ) {
         ec.assign( err, system::system_category );
- return time_point();
+ return time_point();
     }
+ ec.clear();
     return time_point(duration(fp(ec)));
 }
 

Modified: sandbox/chrono/libs/chrono/src/mac/process_clock.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/src/mac/process_clock.cpp (original)
+++ sandbox/chrono/libs/chrono/src/mac/process_clock.cpp 2010-06-22 18:27:52 EDT (Tue, 22 Jun 2010)
@@ -60,7 +60,7 @@
       {
         assert( 0 && "error handling not implemented yet" );
 
- ec = system::error_code( errno, system::system_category );
+ ec.assign( errno, system::system_category );
         times_.real = times_.system = times_.user = nanoseconds(-1);
       }
       else
@@ -73,11 +73,12 @@
           times_.real *= tick_factor();
           times_.user *= tick_factor();
           times_.system *= tick_factor();
+ ec.clear();
         }
         else
         {
- assert( 0 && "error handling not implemented yet" );
- ec = system::error_code( errno, system::system_category );
+ assert( 0 && "error handling not implemented yet" );
+ ec.assign( errno, system::system_category );
           times_.real = times_.user = times_.system = nanoseconds(-1);
         }
       }

Modified: sandbox/chrono/libs/chrono/src/posix/process_clock.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/src/posix/process_clock.cpp (original)
+++ sandbox/chrono/libs/chrono/src/posix/process_clock.cpp 2010-06-22 18:27:52 EDT (Tue, 22 Jun 2010)
@@ -51,7 +51,7 @@
         if ( c == clock_t(-1) ) // error
         {
             assert( 0 && "error handling not implemented yet" );
- ec = system::error_code( errno, system::system_category );
+ ec.assign( errno, system::system_category );
             times_.real = times_.system = times_.user = nanoseconds(-1);
         }
         else
@@ -68,7 +68,7 @@
             else
             {
                 assert( 0 && "error handling not implemented yet" );
- ec = system::error_code( errno, system::system_category );
+ ec.assign( errno, system::system_category );
                 times_.real = times_.user = times_.system = nanoseconds(-1);
             }
         }

Modified: sandbox/chrono/libs/chrono/src/run_timer.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/src/run_timer.cpp (original)
+++ sandbox/chrono/libs/chrono/src/run_timer.cpp 2010-06-22 18:27:52 EDT (Tue, 22 Jun 2010)
@@ -136,6 +136,7 @@
 
       process_times times;
       elapsed( times, ec );
+ if (ec) return;
 
       if ( &ec == &system::throws )
       {
@@ -146,13 +147,14 @@
         try
         {
           show_time( times, m_format.c_str(), m_places, m_os );
- ec = system::error_code();
+ ec.clear();
         }
 
         catch (...) // eat any exceptions
         {
           assert( 0 && "error reporting not fully implemented yet" );
- //ec = error_code( EIO, errno_ecat );
+ ec.assign(system::errc::success, system::generic_category);
+ //ec = error_code( EIO, errno_ecat );
         }
       }
     }

Modified: sandbox/chrono/libs/chrono/src/win/process_clock.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/src/win/process_clock.cpp (original)
+++ sandbox/chrono/libs/chrono/src/win/process_clock.cpp 2010-06-22 18:27:52 EDT (Tue, 22 Jun 2010)
@@ -36,6 +36,7 @@
       if ( ::GetProcessTimes( ::GetCurrentProcess(), &creation, &exit,
              &system_time, &user_time ) )
       {
+ ec.clear();
         times_.user = duration(
           ((static_cast<time_point::rep>(user_time.dwHighDateTime) << 32)
             | user_time.dwLowDateTime) * 100 );


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