Accept long time
This commit is contained in:
parent
45ce5f8404
commit
d46117cda1
1 changed files with 16 additions and 9 deletions
|
|
@ -39,13 +39,16 @@ class eoTimeCounter : public eoUpdater, public eoValueParam<double>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
eoTimeCounter() : eoValueParam<double>(0.0, "Time") // : firstTime(true)
|
eoTimeCounter() : eoValueParam<double>(0.0, "Time") // : firstTime(true)
|
||||||
{}
|
{
|
||||||
|
start = time(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/** simply stores the time spent in process in its value() */
|
/** simply stores the time spent in process in its value() */
|
||||||
virtual void operator()()
|
virtual void operator()()
|
||||||
{
|
{
|
||||||
// ask for system time
|
// ask for system time
|
||||||
utime = clock();
|
utime = clock();
|
||||||
|
|
||||||
// if (firstTime) /* first generation */
|
// if (firstTime) /* first generation */
|
||||||
// {
|
// {
|
||||||
// firstTime=false;
|
// firstTime=false;
|
||||||
|
|
@ -53,13 +56,17 @@ public:
|
||||||
// }
|
// }
|
||||||
// store elapsed user time
|
// store elapsed user time
|
||||||
// value(tmsStruct.tms_utime - firstUtime);
|
// value(tmsStruct.tms_utime - firstUtime);
|
||||||
value()=double(utime)/CLOCKS_PER_SEC;
|
// value()=double(utime)/CLOCKS_PER_SEC;
|
||||||
|
double seconds_elapsed = time(NULL) - start;
|
||||||
|
|
||||||
|
value() = (seconds_elapsed > 2140) ? seconds_elapsed : double(utime)/CLOCKS_PER_SEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// bool firstTime;
|
// bool firstTime;
|
||||||
// clock_t firstUtime;
|
// clock_t firstUtime;
|
||||||
clock_t utime;
|
clock_t utime;
|
||||||
|
time_t start;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Reference in a new issue