show remote time

@param string $url the time original

@return int
421567
public function remoteCommand($url = 'http://www.baidu.com')
    {
        $timestamp = $this->_getRemoteTimestamp($url);
        if ($timestamp === false) {
            return $this->console->error(['fetch remote timestamp failed: `:url`', 'url' => $url]);
        } else {
            $this->console->writeLn(date('Y-m-d H:i:s', $timestamp));
            return 0;
        }
    }
274187
public static function redirect($url, $time = 0)
    {
        strpos($url, 'http') === false && $url = self::url($url, 0);
        if (!headers_sent()) {
            ($time === 0) && header("Location: {$url}");
            header("refresh:{$time};url={$url}");
            exit();
        } else {
            exit("<meta http-equiv='Refresh' content='{$time};URL={$url}'>");
        }
    }
418369
private function getExpiresTime($time): int
    {
        if ($time instanceof \DateTimeInterface) {
            return (int) $time->format('U');
        }

        if (\is_numeric($time)) {
            // average year in seconds
            if ($time <= 31557600) {
                $time += \time();
            }

            return (int) $time;
        }

        return (int) (new \DateTime($time))->format('U');
    }
634880
public function modifiedTime($remoteFile, $format = null)
    {
        $time = ftp_mdtm($this->connection, $remoteFile);

        if ( $time !== -1 && $format !== null ) {
            return date($format, $time);
        } else {
            return $time;
        }
    }
1071636
public static function validateUrl($url, $timeout=5) {
    $urlParts = @parse_url($url);
    // check local relative url
    if (empty($urlParts["host"])) {
      $fh = @fopen($url, "r");
      return ($fh !== false);
    }

    // check remote url
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, true);
    curl_setopt($ch, CURLOPT_NOBODY, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
    $r = curl_exec($ch);
    $headers = split("\n", $r);

    preg_match('/.+ ([0-9]{3}) .+/', $headers[0], $matches);
    return (intval($matches[1]) < 400);
  }
907861
protected function _setSmtpProtocol($url)
    {
        $protocol = '';
        $smtpHost = $url;
        $match = [];
        if (Str::getStr()->preg_match('@^([0-9a-z]+://)?(.*)$@i', $url, $match)) {
            if ($match[1]) {
                if (($match[1] == 'ssl://') || ($match[1] == 'tls://')) {
                    $this->set("SMTPSecure", substr($match[1], 0, 3));
                } else {
                    $protocol = $match[1];
                }
            }
            $smtpHost = $match[2];
        }

        return $protocol . $smtpHost;
    }
488319
protected function _getRemoteData($url)
    {
        ini_set('user_agent', $this->_getUserAgent());

        switch ($this->_getUpdateMethod()) {
            case self::UPDATE_LOCAL:
                $file = file_get_contents($url);

                if ($file !== false) {
                    return $file;
                } else {
                    throw new Exception('Cannot open the local file');
                }
            case self::UPDATE_FOPEN:
                // include proxy settings in the file_get_contents() call
                $context = $this->_getStreamContext();
                $file = file_get_contents($url, false, $context);

                if ($file !== false) {
                    return $file;
                } // else try with the next possibility (break omitted)
            case self::UPDATE_FSOCKOPEN:
                $remote_url = parse_url($url);
                $remote_handler = fsockopen($remote_url['host'], 80, $c, $e, $this->timeout);

                if ($remote_handler) {
                    stream_set_timeout($remote_handler, $this->timeout);

                    if (isset($remote_url['query'])) {
                        $remote_url['path'] .= '?' . $remote_url['query'];
                    }

                    $out = sprintf(
                        self::REQUEST_HEADERS,
                        $remote_url['path'],
                        $remote_url['host'],
                        $this->_getUserAgent()
                    );

                    fwrite($remote_handler, $out);

                    $response = fgets($remote_handler);
                    if (strpos($response, '200 OK') !== false) {
                        $file = '';
                        while (!feof($remote_handler)) {
                            $file .= fgets($remote_handler);
                        }

                        $file = str_replace("\r\n", "\n", $file);
                        $file = explode("\n\n", $file);
                        array_shift($file);

                        $file = implode("\n\n", $file);

                        fclose($remote_handler);

                        return $file;
                    }
                } // else try with the next possibility
            case self::UPDATE_CURL:
                $ch = curl_init($url);

                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->timeout);
                curl_setopt($ch, CURLOPT_USERAGENT, $this->_getUserAgent());

                $file = curl_exec($ch);

                curl_close($ch);

                if ($file !== false) {
                    return $file;
                } // else try with the next possibility
            case false:
                throw new Exception('Your server can\'t connect to external resources. Please update the file manually.');
        }
        
        return '';
    }
1297956
static public function get_time() {
        // By David Maciel (jdmaciel@gmail.com)
        list($microsecond, $second) = explode(" ", \microtime());
        // remove '0.' from the beginning and trailing zeros(2) from the end
        $microsecond = substr($microsecond, 2, -2);
        return (int) $second . $microsecond;
    }
308862
public static function HoursFromDuration( $arg )
	{
		if ( $arg instanceof Undefined )
		{
			return Undefined::getValue();
		}

		/**
		 * @var DurationValue $duration
		 */
		$duration = $arg;

		return Integer::FromValue( $duration->getHours() * ( $duration->getInverted() ? -1 : 1 ) );
	}
1327153
public function countShares($url)
    {
        $api_url = sprintf(self::API_URL, urlencode($url));
        $data = null;
        try {
            $data = json_decode(file_get_contents($api_url), true);
        } catch (\Exception $e) {
            $data = null;
        }

        return ($data !== null && isset($data[0]->share_count)) ? intval($data[0]->share_count) : 0;
    }
894339
public function getlastmod($URL,$host){
		//TODO some usefule things
		return new DateTime();
		$this->parseurl($URL,$host);
		$this->render_positions();
		
		$lastmod=NULL;
		foreach($this->rules as &$c){
			if(isset($c->modified)){
				if($c->modified instanceof DateTime){
					$last_modified=$c->modified;
					}else{
					$last_modified=new DateTime($c->modified);
					}
				if((!empty($lastmod))){
					$interval=date_diff($lastmod,$last_modified);
					}
				if((empty($lastmod))||($interval->invert==0)){
					$lastmod=$last_modified;
					}
				}
			}
		return $lastmod;		
		}
1230354
public static function time(string $value): bool
    {
        $matches = preg_match('/^(\d{2}):(\d{2}):(\d{2})$/', $value);
        return is_int($matches) && $matches > 0;
    }
776804
public function getTotalRedirectionTime()
    {
        return array_reduce(iterator_to_array($this->getCommands()), function ($time, $value) {
            $time += $value['curl']['redirectTime'];

            return $time;
        });
    }
35916
public static function getTimestamp()
	{
		$curl	= new Net_CURL( self::$url );
		$result	= $curl->exec();
		$status	= $curl->getStatus();
		if( $status['http_code'] != 200 )
			throw new Exception( "Service URL is not reachable." );
		$parts	= explode( "\n", $result );
		$date	= trim( $parts[2] );
		$time	= strtotime( $date );
		return $time;
	}
1297283
function get_timestamp() {
        if (!empty($this->timestamp)) {
            $timestamp = $this->timestamp;
            unset($this->timestamp);
            return $timestamp;
        }
        return time();
    }
349650
public function modifiedTime($remoteFile, $format = null)
    {
        $time = $this->ftp->mdtm($remoteFile);

        if ($time !== -1 && $format !== null) {
            return date($format, $time);
        }

        return $time;
    }
44498
protected function timestamped_endpoint( $url ) {
		// Make string for cache with GMT.
		// This is for caching thus you get
		// unique request only for 1 time in 10 minutes.
		$time = substr( date_i18n( 'YmdHi', false, true ), 0, -1 ) . '0';
		return add_query_arg( [
			'timestamp' => $time,
		], $url );
	}