<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.misc.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ja',
  ),
  'this' => 
  array (
    0 => 'function.hrtime.php',
    1 => 'hrtime',
    2 => 'システムの高精度な時刻を取得する',
  ),
  'up' => 
  array (
    0 => 'ref.misc.php',
    1 => 'その他の関数',
  ),
  'prev' => 
  array (
    0 => 'function.highlight-string.php',
    1 => 'highlight_string',
  ),
  'next' => 
  array (
    0 => 'function.ignore-user-abort.php',
    1 => 'ignore_user_abort',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'reference/misc/functions/hrtime.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.hrtime" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">hrtime</h1>
  <p class="verinfo">(PHP 7 &gt;= 7.3.0, PHP 8)</p><p class="refpurpose"><span class="refname">hrtime</span> &mdash; <span class="dc-title">システムの高精度な時刻を取得する</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"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$as_number</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong></span></span>): <span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.float.php" class="type float">float</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="simpara">
   任意のタイミングから計測したシステムの高精度な時刻を取得します。
   返されたタイムスタンプは単調であり、調整できません。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.hrtime-parameters">
  <h3 class="title">パラメータ</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">as_number</code></dt>
     <dd>
      <p class="para">
       高精度の時刻を <span class="type"><a href="language.types.array.php" class="type array">array</a></span> で取得するか、数値で取得するかを指定します。
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.hrtime-returnvalues">
  <h3 class="title">戻り値</h3>
  <p class="para">
   <code class="parameter">as_number</code> が <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> の場合は、
   [秒, ナノ秒] の形式で数値の配列を返します。
   <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> の場合、ナノ秒を (64ビットプラットフォームの場合) <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
   または <span class="type"><a href="language.types.float.php" class="type float">float</a></span> (32ビットプラットフォームの場合) として返します。
   失敗した場合は <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> を返します。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.hrtime-examples">
  <h3 class="title">例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>例1 <span class="function"><strong>hrtime()</strong></span> の使い方</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">hrtime</span><span style="color: #007700">(</span><span style="color: #0000BB">true</span><span style="color: #007700">), </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></code></div>
    </div>

    <div class="example-contents"><p>上の例の出力は、
たとえば以下のようになります。</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">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><a href="book.hrtime.php" class="link">High resolution timing</a> 拡張モジュール</li>
   <li><span class="function"><a href="function.microtime.php" class="function" rel="rdfs-seeAlso">microtime()</a> - 現在の Unix タイムスタンプをマイクロ秒まで返す</span></li>
  </ul>
 </div>


</div><?php manual_footer($setup); ?>