gettimeofday

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

gettimeofday — 현재 시간 가져오기


설명

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

이것은 gettimeofday(2)에 대한 인터페이스입니다. 시스템 호출에서 반환된 데이터를 포함하는 연관 배열을 반환합니다.


매개변수

as_float
true로 설정하면 배열 대신 부동 소수점이 반환됩니다.

반환 값

기본적으로 배열이 반환됩니다. as_float가 설정되면 float가 반환됩니다.

배열 키:

  • "sec" - seconds since the Unix Epoch
  • "usec" - microseconds
  • "minuteswest" - minutes west of Greenwich
  • "dsttime" - type of dst correction

Examples

예제 #1 gettimeofday() 예제

                  
<?php
print_r(gettimeofday());

echo gettimeofday(true);
?>
                  
                

위의 예는 다음과 유사한 결과를 출력합니다.

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

1073504408.23910