int MaxTimePerScan = (int) (1000.0 / waitScanRate);
int timeoutMilli = (int) timeout * 1000;
long begin_t = (new Date()).getTime();
do {
long before_find = (new Date()).getTime();
run();
if (ifSuccessful()) {
return true;
} else if (timeoutMilli < MaxTimePerScan) {
// instant return on first search failed if timeout very small or 0
return false;
}
This is my fix:
int MaxTimePerScan = (int) (1000.0 / waitScanRate);
int timeoutMilli = (int) timeout * 1000;
long begin_t = (new Date()).getTime();
do {
long before_find = (new Date()).getTime();
run();
if (ifSuccessful()) {
return true;
} else if (timeoutMilli < MaxTimePerScan) {
// instant return on first search failed if timeout very small or 0
return false;
}