uTools-Manuals/docs/php/hrtime.html
2019-04-28 19:00:34 +08:00

100 lines
3.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Get the system's high resolution time</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.hrtime" class="refentry">
<div class="refnamediv">
<h1 class="refname">hrtime</h1>
<p class="verinfo">(PHP 7 &gt;= 7.3.0)</p><p class="refpurpose"><span class="refname">hrtime</span> &mdash; <span class="dc-title">Get the system&#039;s high resolution time</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.hrtime-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>hrtime</strong></span>
([ <span class="methodparam"><span class="type">bool</span> <code class="parameter">$get_as_number</code><span class="initializer"> = <strong><code>FALSE</code></strong></span></span>
] ) : <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span></div>
<p class="simpara">
Returns the system&#039;s high resolution time, counted from an arbitrary point in time.
The delivered timestamp is monotonic and can not be adjusted.
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.hrtime-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">get_as_number</code></dt>
<dd>
<p class="para">
Whether the high resolution time should be returned as <span class="type"><a href="language.types.array.html" class="type array">array</a></span>
or number.
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.hrtime-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
Returns an array of integers in the form [seconds, nanoseconds], if the
parameter <code class="parameter">get_as_number</code> is false. Otherwise the nanoseconds
are returned as <span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span> (64bit platforms) or <span class="type"><a href="language.types.float.html" class="type float">float</a></span>
(32bit platforms).
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.hrtime-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-4541">
<p><strong>Example #1 <span class="function"><strong>hrtime()</strong></span> usage</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">hrtime</span><span style="color: #007700">(</span><span style="color: #0000BB">true</span><span style="color: #007700">),&nbsp;</span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">hrtime</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
<div class="example-contents"><p>以上例程的输出类似于:</p></div>
<div class="example-contents screen">
<div class="cdata"><pre>
10444739687370679
Array
(
[0] =&gt; 10444739
[1] =&gt; 687464812
)
</pre></div>
</div>
</div>
</p>
</div>
<div class="refsect1 seealso" id="refsect1-function.hrtime-seealso">
<h3 class="title">参见</h3>
<ul class="simplelist">
<li class="member">The <a href="book.hrtime.html" class="link">High resolution timing</a> extension</li>
</ul>
</div>
</div></div></div></body></html>