array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.gettimeofday.php', 1 => 'gettimeofday', ), 'up' => array ( 0 => 'ref.datetime.php', 1 => 'Date/Time 函数', ), 'prev' => array ( 0 => 'function.getdate.php', 1 => 'getdate', ), 'next' => array ( 0 => 'function.gmdate.php', 1 => 'gmdate', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'reference/datetime/functions/gettimeofday.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4, PHP 5, PHP 7, PHP 8)
gettimeofday — 取得当前时间
本函数是 gettimeofday(2) 的接口。返回一个关联数组,包含有系统调用返回的数据。
默认返回 array。如果设置了 as_float
则会返回 float。
数组中的键为:
示例 #1 gettimeofday() 例子
<?php
print_r(gettimeofday());
echo gettimeofday(true);
?>
以上示例的输出类似于:
Array ( [sec] => 1073504408 [usec] => 238215 [minuteswest] => 0 [dsttime] => 1 ) 1073504408.23910