private static function keepSecondsWithinTimeout($seconds, $timedOut)
    {
        if (is_null($timedOut)) {
            return $seconds;
        }
        $remainingSeconds = max($timedOut - microtime(true), 0);
        return min($remainingSeconds, $seconds);
    }
private static function keepSecondsWithinTimeout($seconds, $timedOut)
    {
        if (is_null($timedOut)) {
            return $seconds;
        }
        $remainingSeconds = max($timedOut - microtime(true), 0);
        return min($remainingSeconds, $seconds);
    }
private static function keepSecondsWithinTimeout ( $ seconds , $ timedOut ) { if ( is_null ( $ timedOut ) ) { return $ seconds ; } $ remainingSeconds = max ( $ timedOut - microtime ( true ) , 0 ) ; return min ( $ remainingSeconds , $ seconds ) ; }
Adjusts the wait seconds to be within the timeout.

@param float $seconds Seconds to wait for the next consume try.
@param float|null $timedOut Timestamp when to time out.

@return float Seconds for waiting
Adjusts the wait seconds to be within the timeout .