Set request timeout value (in seconds).

@param int $timeout

@return int
188223
public function setTimeout($timeout)
    {
        $timeout = is_scalar($timeout) ? (int) $timeout : 0;

        return $timeout < 1
            ? $this->timeout
            : $this->timeout = $timeout;
    }
994051
public function setConnectionTimeout($connectionTimeout) {
		if (!is_numeric($connectionTimeout) || $connectionTimeout < 0) {
			throw new \InvalidArgumentException('Timeout value must be numeric and a non-negative number.');
		}

		$this->connectionTimeout = $connectionTimeout;
		return $this;
	}
1010804
public function setTimeout($timeout) {
        if (!is_int($timeout)) throw new IllegalTypeException('Illegal type of parameter $timeout: '.gettype($timeout));
        if ($timeout < 1)      throw new InvalidArgumentException('Invalid argument $timeout: '.$timeout);

        $this->timeout = $timeout;
        return $this;
    }
71048
public function send($timeout=null) 
	{
		$format = $this->params->getString("format",null);

		if (!strrpos($this->method, ".")) {
			$this->host = "socialize.".$this->apiDomain;
			$this->path = "/socialize.".$this->method;
		} else {
			$tokens = explode( ".", $this->method );
			$this->host = $tokens[0].".".$this->apiDomain;
			$this->path = "/".$this->method;
		}
		
		//set json as default format.
		if (empty($format))
		{
			$format =  "json";
			$this->setParam("format", $format);
		}
		if(!empty($timeout))
		{
			$this->traceField("timeout",$timeout);
		}
		
		if (empty($this->method) || (empty($this->apiKey) and empty($this->userKey)) )
		{
			return new GSResponse($this->method,null,$this->params,400002,null,$this->traceLog);
		}
		
		if ($this->useHTTPS && empty(GSRequest::$cafile)) 
		{
			return new GSResponse($this->method,null,$this->params,400003,null,$this->traceLog);
		}

		try 
		{
			$this->setParam("httpStatusCodes", "false");
			
			$this->traceField("userKey", $this->userKey);
			$this->traceField("apiKey", $this->apiKey);
			$this->traceField("apiMethod", $this->method);
			$this->traceField("params",$this->params);
			$this->traceField("useHTTPS", $this->useHTTPS);

			$responseStr = $this->sendRequest("POST", $this->host, $this->path, $this->params, $this->apiKey, $this->secretKey, $this->useHTTPS,$timeout, $this->userKey);
			
			return new GSResponse($this->method,$responseStr,null,0,null,$this->traceLog);
		}
		catch (Exception $ex) {
			$errcode = 500000;
			$errMsg = $ex->getMessage();
		    $length = strlen("Operation timed out");
		    if((substr($ex->getMessage(), 0, $length) === "Operation timed out"))
			{
				 $errcode = 504002;
				 $errMsg = "Request Timeout";
			}
	
			return new GSResponse($this->method,null,$this->params,$errcode,$errMsg, $this->traceLog);
		}
	}
860946
protected function childSetTimeout($timeout)
    {
        $start_time = time();
        $self = $this;
        $this->on('tick', function () use ($timeout, $start_time, $self) {
            if ($start_time + $timeout < time()) $self->shutdown(1);
        });
    }
1067573
public function connect($timeout = null)
    {
        if ($timeout === null) {
            $timeout = intval(ini_get('default_socket_timeout'));
        }

        $this->timeout      = $timeout;
        $this->streamSocket = $this->getStream(
            $this->options->getAddress(), $timeout, $this->options->getStreamContext());
        $this->setStreamTimeout($timeout);

        $infoResponse = $this->receive();

        if ($this->isErrorResponse($infoResponse) === true) {
            throw Exception::forFailedConnection($infoResponse);
        } else {
            $this->processServerInfo($infoResponse);
            if ($this->serverInfo->isTLSRequired()) {
                set_error_handler(
                    function ($errno, $errstr, $errfile, $errline) {
                        restore_error_handler();
                        throw Exception::forFailedConnection($errstr);
                    });

                if (!stream_socket_enable_crypto(
                        $this->streamSocket, true, STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT)) {
                    throw Exception::forFailedConnection('Error negotiating crypto');
                }

                restore_error_handler();
            }
        }

        $msg = 'CONNECT '.$this->options;
        $this->send($msg);
        $this->ping();
        $pingResponse = $this->receive();

        if ($this->isErrorResponse($pingResponse) === true) {
            throw Exception::forFailedPing($pingResponse);
        }
    }
1046862
public function iterate($timeout)
    {

        // call parent method and sleep for the default timeout
        parent::iterate($timeout);

        // create the requested timer instance
        $this->synchronized(function ($self) {

            // create the timer, only if we're NOT dispatched
            if ($self->dispatched === false) {
                $self->timer = Timer::builder()
                    ->setNewTimer(true)
                    ->setId(Uuid::uuid4()->__toString())
                    ->setInitialDate($self->initialExpiration)
                    ->setRepeatInterval($self->intervalDuration)
                    ->setInfo($self->info)
                    ->setPersistent($self->persistent)
                    ->setTimerState(TimerState::CREATED)
                    ->setTimedObjectId($self->timerService->getTimedObjectInvoker()->getTimedObjectId())
                    ->build($self->timerService);

                // we're dispatched now
                $self->dispatched = true;
            }

        }, $this);

        // profile the size of the sessions
        if ($this->profileLogger) {
            $this->profileLogger->debug(
                sprintf('Size of session pool is: %d', sizeof($this->sessionPool))
            );
        }
    }
471223
public function timeout($delay = null) {
        if ($delay === null) {
            return $this->_timeout;
        }
        if (!$this->valid()) {
            throw new RuntimeException("Invalid stream resource, unable to set a timeout on it.");
        }
        $this->_timeout = $delay;
        return stream_set_timeout($this->_resource, 0, $delay);
    }
233779
public function block($timeout, $callback = null)
    {
        $starting = time();

        $id = Str::random(20);

        while (! $slot = $this->acquire($id)) {
            if (time() - $timeout >= $starting) {
                throw new LimiterTimeoutException;
            }

            usleep(250 * 1000);
        }

        if (is_callable($callback)) {
            try {
                return tap($callback(), function () use ($slot, $id) {
                    $this->release($slot, $id);
                });
            } catch (Exception $exception) {
                $this->release($slot, $id);

                throw $exception;
            }
        }

        return true;
    }
301773
function setTimeout($seconds)
    {
        if (is_array($seconds))
            $seconds = implode('.', $seconds);

        $this->timeout = $seconds;
        return $this;
    }
1202132
public static function setTimeout($timeout)
	{
		self::$options[CURLOPT_TIMEOUT] = $timeout;
		self::$options[CURLOPT_CONNECTTIMEOUT] = $timeout;
	}
1336677
public function setTimeout($timeout)
    {
        if ($this->status != self::STATUS_NEW) {
            throw new \RuntimeException('Cannot set worker timeout after worker has started working');
        }

        $this->timeout = $timeout;
    }
1131493
public function wait($timeout = 30)
    {
        $lastException = null;
        for ($i = 0; $i < $timeout; $i++) {
            try {
                $this->text();
                return $this;
            } catch (WebDriver_Exception $e) {
                $lastException = $e;
                sleep(1);
            }
        }

        if (null !== $lastException) {
            throw $lastException;
        }

        return $this;
    }
417415
public function timeout($timeout = null)
    {
        // Return value
        if (empty($timeout)) {
            return $this->timeout;
        }

        // Set value
        $this->timeout = $timeout;

        return $this;
    }
1105915
public function connect($timeout = 90) {
        $host = $this->getAuthenticator()->getHost();
        $port = $this->getAuthenticator()->getPort();
        $this->setConnection(@ftp_connect($host, $port, $timeout));
        if (false === $this->getConnection()) {
            throw $this->newFTPException("connection failed");
        }
        return $this;
    }
1327635
public function wait($timeout = 60)
    {
        $timeoutMicro = $timeout !== null ? microtime(true) + (float)$timeout : null;
        while ($this->isRunning()) {
            if ($timeout !== null && microtime(true) >= $timeoutMicro) {
                return null;
            }
            usleep(1000);
        }

        return $this->getExitCode();
    }
144546
public function wait($timeout, $condition) {
    $start = microtime(true);
    $end = $start + $timeout / 1000.0;
    do {
      $result = $this->browser->evaluate($condition);
      if ($result) {
        // No need to wait any longer when the condition is met already.
        return TRUE;
      }
      usleep(100000);
    } while (microtime(true) < $end && !$result);

    return (bool)$result;
  }