diff --git a/src/search.cpp b/src/search.cpp index 6a2f8f2d2..edd8d9eb5 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -520,8 +520,8 @@ void Search::Worker::iterative_deepening() { && !mainThread->ponder) threads.stop = true; - // Stop the search if we have exceeded the totalTime - if (elapsedTime > totalTime) + // Stop the search if we have exceeded the totalTime or maximum + if (elapsedTime > std::min(totalTime, double(mainThread->tm.maximum()))) { // If we are allowed to ponder do not stop the search now but // keep pondering until the GUI sends "ponderhit" or "stop".