<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.datetime.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ru',
  ),
  'this' => 
  array (
    0 => 'function.gettimeofday.php',
    1 => 'gettimeofday',
    2 => 'Возвращает текущее время',
  ),
  'up' => 
  array (
    0 => 'ref.datetime.php',
    1 => 'Функции даты и времени',
  ),
  'prev' => 
  array (
    0 => 'function.getdate.php',
    1 => 'getdate',
  ),
  'next' => 
  array (
    0 => 'function.gmdate.php',
    1 => 'gmdate',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ru',
    'path' => 'reference/datetime/functions/gettimeofday.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.gettimeofday" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">gettimeofday</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">gettimeofday</span> &mdash; <span class="dc-title">Возвращает текущее время</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.gettimeofday-description">
  <h3 class="title">Описание</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>gettimeofday</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$as_float</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.float.php" class="type float">float</a></span></span></div>

  <p class="para rdfs-comment">
   Функция — интерфейс к системному вызову функции gettimeofday(2).
   Функция возвращает ассоциативный массив с информацией, которую получила от системного вызова.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.gettimeofday-parameters">
  <h3 class="title">Список параметров</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">as_float</code></dt>
     <dd>
      <p class="para">
       При передаче значения <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> вместо массива возвращается число
       с плавающей точкой.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.gettimeofday-returnvalues">
  <h3 class="title">Возвращаемые значения</h3>
  <p class="para">
   По умолчанию функция возвращает массив (<span class="type"><a href="language.types.array.php" class="type array">array</a></span>).
   При установке параметра <code class="parameter">as_float</code> возвращается значение <span class="type"><a href="language.types.float.php" class="type float">float</a></span>.
  </p>
  <p class="para">
   Ключи массива:
   <ul class="itemizedlist">
    <li class="listitem">
     <span class="simpara">
      &quot;sec&quot; — количество секунд, которое прошло с начала эпохи Unix
     </span>
    </li>
    <li class="listitem">
     <span class="simpara">
      &quot;usec&quot; — микросекунды
     </span>
    </li>
    <li class="listitem">
     <span class="simpara">
      &quot;minuteswest&quot; — смещение к западу от Гринвича, в минутах
     </span>
    </li>
    <li class="listitem">
     <span class="simpara">
      &quot;dsttime&quot; — тип коррекции летнего времени
     </span>
    </li>
   </ul>
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.gettimeofday-examples">
  <h3 class="title">Примеры</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Пример #1 Пример получения информации о времени функцией <span class="function"><strong>gettimeofday()</strong></span></strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">gettimeofday</span><span style="color: #007700">());<br /><br />echo </span><span style="color: #0000BB">gettimeofday</span><span style="color: #007700">(</span><span style="color: #0000BB">true</span><span style="color: #007700">);</span></span></code></div>
    </div>

    
<div class="example-contents"><p>
 Вывод приведённого примера будет похож на:
</p></div>

    <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">Array
(
    [sec] =&gt; 1073504408
    [usec] =&gt; 238215
    [minuteswest] =&gt; 0
    [dsttime] =&gt; 1
)
1073504408.23910</pre>
</div>
    </div>
   </div>
  </p>
 </div>

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