ensure that the "timeremain" thermo keyword never reports a negative remaining time

This commit is contained in:
Axel Kohlmeyer
2024-02-02 11:53:40 -05:00
parent 33e57e50e8
commit 82f106c12a

View File

@ -200,7 +200,10 @@ bool Timer::_check_timeout()
/* ---------------------------------------------------------------------- */
double Timer::get_timeout_remain()
{
return (_timeout < 0.0) ? 0.0 : _timeout + timeout_start - platform::walltime();
double remain = _timeout + timeout_start - platform::walltime();
// flag timeout if the timer expires right now
if (remain < 0.0) remain = 0.0;
return (_timeout < 0.0) ? 0.0 : remain;
}
/* ----------------------------------------------------------------------