Add getter and setter of starting time in moTimeContinue
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1964 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
0ae47e9300
commit
a31f85b2fd
1 changed files with 30 additions and 7 deletions
|
|
@ -48,10 +48,30 @@ public:
|
||||||
* @param _verbose verbose mode true/false -> on/off
|
* @param _verbose verbose mode true/false -> on/off
|
||||||
*/
|
*/
|
||||||
moTimeContinuator(time_t _max, bool _verbose=true): max(_max), verbose(_verbose) {
|
moTimeContinuator(time_t _max, bool _verbose=true): max(_max), verbose(_verbose) {
|
||||||
|
external = false;
|
||||||
start = time(NULL);
|
start = time(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Synchronize the whole time with an external starting time
|
||||||
|
* @param _externalStart external starting time
|
||||||
|
*/
|
||||||
|
virtual void setStartingTime(time_t _externalStart) {
|
||||||
|
external = true;
|
||||||
|
start = _externalStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To get the starting time
|
||||||
|
* @return starting time
|
||||||
|
*/
|
||||||
|
virtual time_t getStartingTime() {
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns false when the running time is reached.
|
* Returns false when the running time is reached.
|
||||||
* @param _sol the current solution
|
* @param _sol the current solution
|
||||||
|
|
@ -71,6 +91,7 @@ public:
|
||||||
* @param _solution a solution
|
* @param _solution a solution
|
||||||
*/
|
*/
|
||||||
virtual void init(EOT & _solution) {
|
virtual void init(EOT & _solution) {
|
||||||
|
if (!external)
|
||||||
start = time(NULL);
|
start = time(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -90,6 +111,8 @@ private:
|
||||||
time_t max;
|
time_t max;
|
||||||
/** starting time */
|
/** starting time */
|
||||||
time_t start;
|
time_t start;
|
||||||
|
/** external start flag */
|
||||||
|
bool external;
|
||||||
/** verbose mode */
|
/** verbose mode */
|
||||||
bool verbose;
|
bool verbose;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue