CakeFest 2024: The Official CakePHP Conference

gettimeofday

(PHP 4, PHP 5, PHP 7, PHP 8)

gettimeofday現在の時間を得る

説明

gettimeofday(bool $as_float = false): array|float

この関数は、gettimeofday(2) へのインターフェイスです。 この関数は、システムコールから返されたデータを有する連想配列を返します。

パラメータ

as_float

true を指定すると、配列ではなく float で返します。

戻り値

デフォルトでは配列を返します。as_float が設定されている場合は float を返します。

配列のキー:

  • "sec" - UNIX エポックからの秒
  • "usec" - マイクロ秒
  • "minuteswest" - グリニッジ基準の分
  • "dsttime" - 夏時間補正の型

例1 gettimeofday() の例

<?php
print_r
(gettimeofday());

echo
gettimeofday(true);
?>

上の例の出力は、 たとえば以下のようになります。

Array
(
    [sec] => 1073504408
    [usec] => 238215
    [minuteswest] => 0
    [dsttime] => 1
)

1073504408.23910

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top