protected function getTimeout($xml)
    {
        $tz = date_default_timezone_get();
        date_default_timezone_set('UTC');

        $xml = @new \SimpleXMLElement($xml);
        $dt = (int) strtotime($xml->cachedUntil);
        $time = time();

        date_default_timezone_set($tz);

        return max(1, $dt - $time);
    }