From 0d09c0083f86d6ecb4f00386b289eeaea672225c Mon Sep 17 00:00:00 2001 From: guido Date: Wed, 16 Feb 2000 05:30:03 +0000 Subject: [PATCH] ignore start_time bug removed git-svn-id: https://svn.dealii.org/trunk@2410 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/source/timer.cc | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/deal.II/base/source/timer.cc b/deal.II/base/source/timer.cc index 7163cc23b4..244633abe5 100644 --- a/deal.II/base/source/timer.cc +++ b/deal.II/base/source/timer.cc @@ -30,13 +30,16 @@ void Timer::start () double Timer::stop () { - running = false; - rusage usage; - getrusage (RUSAGE_SELF, &usage); - const double dtime = usage.ru_utime.tv_sec + 1.e-6 * usage.ru_utime.tv_usec; - cumulative_time += dtime; + if (running) + { + running = false; + rusage usage; + getrusage (RUSAGE_SELF, &usage); + const double dtime = usage.ru_utime.tv_sec + 1.e-6 * usage.ru_utime.tv_usec; + cumulative_time += dtime - start_time; + } return full_time (); -}; +} @@ -52,7 +55,7 @@ double Timer::operator() () const } else return full_time(); -}; +} @@ -60,13 +63,11 @@ void Timer::reset () { cumulative_time = 0.; running = false; -}; +} double Timer::full_time () const { return cumulative_time; -}; - - +} -- 2.39.5