]> https://gitweb.dealii.org/ - dealii.git/commitdiff
ignore start_time bug removed
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Wed, 16 Feb 2000 05:30:03 +0000 (05:30 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Wed, 16 Feb 2000 05:30:03 +0000 (05:30 +0000)
git-svn-id: https://svn.dealii.org/trunk@2410 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/source/timer.cc

index 7163cc23b46bdcadd9031eaec02a648abac55b0d..244633abe5d98cd86f6535aa9d00ddf3b5b0cf7e 100644 (file)
@@ -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;
-};
-
-
+}

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.