php-doc-en/reference/misc/functions/hrtime.xml
2020-12-26 19:26:31 +00:00

105 lines
2.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://docbook.org/ns/docbook" xml:id="function.hrtime">
<refnamediv>
<refname>hrtime</refname>
<refpurpose>Get the system's high resolution time</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>array</type><type>int</type><type>float</type><type>false</type></type><methodname>hrtime</methodname>
<methodparam choice="opt"><type>bool</type><parameter>as_number</parameter><initializer>&false;</initializer></methodparam>
</methodsynopsis>
<simpara>
Returns the system's high resolution time, counted from an arbitrary point in time.
The delivered timestamp is monotonic and can not be adjusted.
</simpara>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>as_number</parameter></term>
<listitem>
<para>
Whether the high resolution time should be returned as <type>array</type>
or number.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an array of integers in the form [seconds, nanoseconds], if the
parameter <parameter>as_number</parameter> is false. Otherwise the nanoseconds
are returned as <type>int</type> (64bit platforms) or <type>float</type>
(32bit platforms).
Returns &false; on failure.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>hrtime</function> usage</title>
<programlisting role="php">
<![CDATA[
<?php
echo hrtime(true), PHP_EOL;
print_r(hrtime());
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
10444739687370679
Array
(
[0] => 10444739
[1] => 687464812
)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member>The <link linkend="book.hrtime">High resolution timing</link> extension</member>
<member><function>microtime</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->