From 86aafc4955d3e63c1b242c5894f5de717e46c059 Mon Sep 17 00:00:00 2001 From: wolf Date: Fri, 18 Jun 1999 11:49:29 +0000 Subject: [PATCH] Make the evaluation of a timer a constant operation. For this, we have to make the overflow variable 'mutable' since it may be changed by the evaluation operator. This, however, seems justified since the state of the timer is not changed by this operation. Information is only reorganized from the tics counter to the overflow counter. git-svn-id: https://svn.dealii.org/trunk@1415 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/timer.h | 4 ++-- deal.II/base/source/timer.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/deal.II/base/include/base/timer.h b/deal.II/base/include/base/timer.h index 4bc94ec2fb..be586fe4ad 100644 --- a/deal.II/base/include/base/timer.h +++ b/deal.II/base/include/base/timer.h @@ -55,7 +55,7 @@ public: // (which is now nearly every 30 minutes on UNIX machines) in long-time // measurements. // - double operator() (); + double operator() () const; private: @@ -81,7 +81,7 @@ public: * number of seconds after which an * overflow occurs. */ - unsigned int overflow; + mutable unsigned int overflow; /** * Store whether the timer is presently diff --git a/deal.II/base/source/timer.cc b/deal.II/base/source/timer.cc index cc0731a987..f52fd65220 100644 --- a/deal.II/base/source/timer.cc +++ b/deal.II/base/source/timer.cc @@ -45,7 +45,7 @@ double Timer::stop () { -double Timer::operator() () { +double Timer::operator() () const { if (running) { const double dtime = static_cast(clock()) / CLOCKS_PER_SEC - start_time; -- 2.39.5