Get the client timeout value from the config.

@return int the timeout value in seconds
@throws common_ext_ExtensionException
337727
protected function getClientTimeout()
    {
        $ext = $this->getServiceManager()->get(common_ext_ExtensionsManager::SERVICE_ID)->getExtensionById('tao');
        $config = $ext->getConfig('js');
        if($config !== null && isset($config['timeout'])){
            return (int)$config['timeout'];
        }
        return 30;
    }
1371101
private function pingExec() {
    $latency = false;

    $ttl = escapeshellcmd($this->ttl);
    $timeout = escapeshellcmd($this->timeout);
    $host = escapeshellcmd($this->host);

    // Exec string for Windows-based systems.
    if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
      // -n = number of pings; -i = ttl; -w = timeout (in milliseconds).
      $exec_string = 'ping -n 1 -i ' . $ttl . ' -w ' . ($timeout * 1000) . ' ' . $host;
    }
    // Exec string for Darwin based systems (OS X).
    else if(strtoupper(PHP_OS) === 'DARWIN') {
      // -n = numeric output; -c = number of pings; -m = ttl; -t = timeout.
      $exec_string = 'ping -n -c 1 -m ' . $ttl . ' -t ' . $timeout . ' ' . $host;
    }
    // Exec string for other UNIX-based systems (Linux).
    else {
      // -n = numeric output; -c = number of pings; -t = ttl; -W = timeout
      $exec_string = 'ping -n -c 1 -t ' . $ttl . ' -W ' . $timeout . ' ' . $host . ' 2>&1';
    }

    exec($exec_string, $output, $return);

    // Strip empty lines and reorder the indexes from 0 (to make results more
    // uniform across OS versions).
    $this->commandOutput = implode($output, '');
    $output = array_values(array_filter($output));

    // If the result line in the output is not empty, parse it.
    if (!empty($output[1])) {
      // Search for a 'time' value in the result line.
      $response = preg_match("/time(?:=|<)(?<time>[\.0-9]+)(?:|\s)ms/", $output[1], $matches);

      // If there's a result and it's greater than 0, return the latency.
      if ($response > 0 && isset($matches['time'])) {
        $latency = round($matches['time']);
      }
    }

    return $latency;
  }
1356364
protected function recv($timeout = null)
        {
            if (!$this->connected()) {
                throw new Exception('No connection');
            }
            // timeout specified?
            if ($timeout !== null) {
                stream_set_timeout($this->socket, $timeout);
            }
            // retrieve response
            $line = fgets($this->socket, 1024);
            $this->debug('<<<recv: ' . $line);
            // have we timed out?
            $info = stream_get_meta_data($this->socket);
            if (!empty($info['timed_out'])) {
                throw new Exception('Timed out in recv');
            }
            // did we actually receive anything?
            if ($line === false) {
                throw new Exception('No response in recv');
            }
            return $line;
        }
564794
public function getTimeout() : ?int 
    {
        if ( ! $this->hasTimeout()) {
            $this->setTimeout($this->getDefaultTimeout());
        }
        return $this->timeout;
    }
94078
public final int getLoginTimeout() throws SQLException {
        try {
            if(!Driver.class.equals(type)) {
                return ((CommonDataSource) dataSourceOrDriver).getLoginTimeout();
            }
            //Return that the default value is being used when using the Driver type
            return 0;
        } catch (SQLException sqlX) {
            FFDCFilter.processException(sqlX, getClass().getName(), "1670", this);
            throw AdapterUtil.mapSQLException(sqlX, this);
        }
    }
1163495
public function getClientConfig()
    {
        // Allows the section name to be overridden in config
        $name = $this->config()->get('section_name');

        if (!$name) {
            $name = static::class;
        }

        $clientConfig = [
            // Trim leading/trailing slash to make it easier to concatenate URL
            // and use in routing definitions.
            'name' => $name,
            'url' => trim($this->Link(), '/'),
            'form' => [
                'EditorExternalLink' => [
                    'schemaUrl' => $this->Link('methodSchema/Modals/EditorExternalLink'),
                ],
                'EditorEmailLink' => [
                    'schemaUrl' => $this->Link('methodSchema/Modals/EditorEmailLink'),
                ],
            ],
        ];

        $this->extend('updateClientConfig', $clientConfig);

        return $clientConfig;
    }
1234303
public function getSessionTimeOut()
    {
        if ($this->offsetExists('session') && isset($this->session['idleTimeout'])) {
            return $this->session['idleTimeout'];
        } else {
            return $this->defaultSessionTimeout;
        }
    }
163967
public function getTimeout() {
        if($this->timeout)
            return $this->timeout;

        $timeout = 0;
        foreach ($this->requests as $r) {
            $timeout += $r->getTimeout();
        }
        return $timeout;
    }
748970
public function getManifest()
    {
        if (! $this->manifest) {
            $manifestFile = $this->getDir() . self::MANIFEST_NAME;
            if (is_file($manifestFile) && is_readable($manifestFile)) {
                $this->manifest = new common_ext_Manifest($manifestFile);
            } else {
                throw new common_ext_ManifestNotFoundException("Extension Manifest not found for extension '" . $this->id . "'.", $this->id);
            }
        }
        return $this->manifest;
     }
540107
private function getParentClient()
    {
        $client = AdapterUtil::getPropertyValue($this, 'client');

        return null !== $client ? $client : AdapterUtil::getPropertyValue($this, 'lazyClient');
    }
140682
def _get_timeout(self, timeout):
        '''
        
        '''
        if timeout is None:
            return self.opts['timeout']
        if isinstance(timeout, int):
            return timeout
        if isinstance(timeout, six.string_types):
            try:
                return int(timeout)
            except ValueError:
                return self.opts['timeout']
        # Looks like the timeout is invalid, use config
        return self.opts['timeout']
626455
protected function _timedOut()
    {
        $time = $this->read('Config.time');
        $result = false;

        $checkTime = $time !== null && $this->_lifetime > 0;
        if ($checkTime && (time() - (int)$time > $this->_lifetime)) {
            $result = true;
        }

        $this->write('Config.time', time());

        return $result;
    }
317798
public Integer getTimeout()
   {
      if (childNode.getTextValueForPatternName("timeout") != null && !childNode.getTextValueForPatternName("timeout").equals("null")) {
         return Integer.valueOf(childNode.getTextValueForPatternName("timeout"));
      }
      return null;
   }
700112
protected int getTimeoutForResponse() {
        String timeout_s = null;
        int timeout;
        try {
            timeout_s = this.getAttributeValueSmart(TIMEOUT);
            timeout = timeout_s==null?30:Integer.parseInt(timeout_s);
            if (timeout<0) timeout = 30;
        } catch (NumberFormatException e) {
            logger.severeException("Cannot parse timeout value " + timeout_s, e);
            timeout = 30;
        } catch (PropertyException e) {
            logger.severeException("Cannot read timeout attribute " + TIMEOUT, e);
            timeout = 30;
        }
        return timeout;
    }
924972
public function getIsExpired()
    {
        $createdAt = $this->getCreatedAt();
        if ($this->getExpiredAfter() === false || $createdAt === null) {
            return false;
        }
        if ($this->timeType == static::$timeTypeLocal) {
            return $this->getDatetimeOffset($this->offsetDatetime($this->currentDatetime(), -$this->getExpiredAfter()), $createdAt) > 0;
        } elseif ($this->timeType == static::$timeTypeUtc) {
            return $this->getDatetimeOffset($this->offsetDatetime($this->currentUtcDatetime(), -$this->getExpiredAfter()), $createdAt) > 0;
        }
        return false;
    }
220035
public static function getIpFromHeader()
    {
        $general = Config::getInstance()->General;
        $clientHeaders = @$general['proxy_client_headers'];
        if (!is_array($clientHeaders)) {
            $clientHeaders = array();
        }

        $default = '0.0.0.0';
        if (isset($_SERVER['REMOTE_ADDR'])) {
            $default = $_SERVER['REMOTE_ADDR'];
        }

        $ipString = self::getNonProxyIpFromHeader($default, $clientHeaders);
        return IPUtils::sanitizeIp($ipString);
    }
765601
public int connectionTimeoutMs() {
    long defaultNetworkTimeoutS = JavaUtils.timeStringAsSec(
      conf.get("spark.network.timeout", "120s"));
    long defaultTimeoutMs = JavaUtils.timeStringAsSec(
      conf.get(SPARK_NETWORK_IO_CONNECTIONTIMEOUT_KEY, defaultNetworkTimeoutS + "s")) * 1000;
    return (int) defaultTimeoutMs;
  }