From d46117cda1348ad4ba3544bca457e13ef8d3bc4c Mon Sep 17 00:00:00 2001 From: paradiseo Date: Thu, 25 Jun 2009 14:49:53 +0000 Subject: [PATCH] Accept long time --- eo/src/utils/eoTimeCounter.h | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/eo/src/utils/eoTimeCounter.h b/eo/src/utils/eoTimeCounter.h index 0ff34ecc..bfd16c56 100644 --- a/eo/src/utils/eoTimeCounter.h +++ b/eo/src/utils/eoTimeCounter.h @@ -39,27 +39,34 @@ class eoTimeCounter : public eoUpdater, public eoValueParam { public: eoTimeCounter() : eoValueParam(0.0, "Time") // : firstTime(true) - {} - + { + start = time(NULL); + } + /** simply stores the time spent in process in its value() */ virtual void operator()() { // ask for system time utime = clock(); -// if (firstTime) /* first generation */ -// { -// firstTime=false; -// firstUtime = tmsStruct.tms_utime; -// } + + // if (firstTime) /* first generation */ + // { + // firstTime=false; + // firstUtime = tmsStruct.tms_utime; + // } // store elapsed user time -// value(tmsStruct.tms_utime - firstUtime); - value()=double(utime)/CLOCKS_PER_SEC; + // value(tmsStruct.tms_utime - firstUtime); + // value()=double(utime)/CLOCKS_PER_SEC; + double seconds_elapsed = time(NULL) - start; + + value() = (seconds_elapsed > 2140) ? seconds_elapsed : double(utime)/CLOCKS_PER_SEC; } private: // bool firstTime; // clock_t firstUtime; clock_t utime; + time_t start; }; #endif