chiark / gitweb /
fix support for maxtime in Luksan algorithms and ORIG_DIRECT; thanks to Jurgen Werner...
[nlopt.git] / util / stop.c
index 09e8686986e861254c4017ee10ac33632b117d0a..7484ecbbf84b7246295ba7ea00726c9fadeac232 100644 (file)
@@ -86,9 +86,14 @@ int nlopt_stop_evals(const nlopt_stopping *s)
      return (s->maxeval > 0 && s->nevals >= s->maxeval);
 }
 
+int nlopt_stop_time_(double start, double maxtime)
+{
+     return (maxtime > 0 && nlopt_seconds() - start >= maxtime);
+}
+
 int nlopt_stop_time(const nlopt_stopping *s)
 {
-     return (s->maxtime > 0 && nlopt_seconds() - s->start >= s->maxtime);
+     return nlopt_stop_time_(s->start, s->maxtime);
 }
 
 int nlopt_stop_evalstime(const nlopt_stopping *stop)