|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r64837 - sandbox/chrono/boost/chrono
From: vicente.botet_at_[hidden]
Date: 2010-08-15 17:41:12
Author: viboes
Date: 2010-08-15 17:41:11 EDT (Sun, 15 Aug 2010)
New Revision: 64837
URL: http://svn.boost.org/trac/boost/changeset/64837
Log:
* uniform both files
Text files modified:
sandbox/chrono/boost/chrono/stopwatch.hpp | 8 ++++----
sandbox/chrono/boost/chrono/stopwatch_accumulator.hpp | 29 +++++++++++------------------
2 files changed, 15 insertions(+), 22 deletions(-)
Modified: sandbox/chrono/boost/chrono/stopwatch.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/stopwatch.hpp (original)
+++ sandbox/chrono/boost/chrono/stopwatch.hpp 2010-08-15 17:41:11 EDT (Sun, 15 Aug 2010)
@@ -82,7 +82,7 @@
duration frozen;
time_point tmp=clock::now( ec );
if (ec) return time_point();
- if (running_&&(--level_==0)) {
+ if (running_&&(level_==1)) {
partial_ += tmp - start_;
frozen = partial_;
partial_=duration::zero();
@@ -91,7 +91,6 @@
running_=true;
}
start_=tmp;
- ++level_;
return std::make_pair(frozen, start_);
}
@@ -111,7 +110,7 @@
}
duration stop( system::error_code & ec = system::throws ) {
- if (running_&&(--level_==0)) {
+ if (running_ && (--level_==0)) {
time_point tmp=clock::now( ec );
if (ec) return duration::zero();
partial_ += tmp - start_;
@@ -127,14 +126,15 @@
duration suspend( system::error_code & ec = system::throws ) {
if (running_) {
- ++suspend_level_;
if (!suspended_) {
time_point tmp=clock::now( ec );
if (ec) return duration::zero();
+ ++suspend_level_;
partial_ += tmp - start_;
suspended_=true;
return partial_;
} else {
+ ++suspend_level_;
ec.clear();
return duration::zero();
}
Modified: sandbox/chrono/boost/chrono/stopwatch_accumulator.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/stopwatch_accumulator.hpp (original)
+++ sandbox/chrono/boost/chrono/stopwatch_accumulator.hpp 2010-08-15 17:41:11 EDT (Sun, 15 Aug 2010)
@@ -90,7 +90,7 @@
std::pair<duration, time_point> restart( system::error_code & ec = system::throws ) {
time_point tmp=clock::now( ec );
if (ec) return time_point();
- if (running_&&(--level_==0)) {
+ if (running_&&(level_==1)) {
partial_ += tmp - start_;
accumulated_(partial_.count());
partial_=duration::zero();
@@ -98,7 +98,6 @@
running_=true;
}
start_=tmp;
- ++level_;
return std::make_pair(duration(accumulators::sum(accumulated_)),start_);
}
@@ -118,21 +117,14 @@
}
duration stop( system::error_code & ec = system::throws ) {
- if (running_) {
- if (level_==1) {
- time_point tmp=clock::now( ec );
- if (ec) return duration::zero();
- partial_ += tmp - start_;
- accumulated_(partial_.count());
- partial_=duration::zero();
- --level_;
- running_=false;
- return duration(accumulators::sum(accumulated_));
- } else {
- --level_;
- ec.clear();
- return duration::zero();
- }
+ if (running_ && (--level_==0)) {
+ time_point tmp=clock::now( ec );
+ if (ec) return duration::zero();
+ partial_ += tmp - start_;
+ accumulated_(partial_.count());
+ partial_=duration::zero();
+ running_=false;
+ return duration(accumulators::sum(accumulated_));
} else {
ec.clear();
return duration::zero();
@@ -141,14 +133,15 @@
duration suspend( system::error_code & ec = system::throws ) {
if (running_) {
- ++suspend_level_;
if (!suspended_) {
time_point tmp=clock::now( ec );
if (ec) return duration::zero();
+ ++suspend_level_;
partial_ += tmp - start_;
suspended_=true;
return duration(accumulators::sum(accumulated_));
} else {
+ ++suspend_level_;
ec.clear();
return duration::zero();
}
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