컴

time_nanosleep — 수초 및 나노 초 동안 지연

· 2017-01-31 (화) 22:30:05 · 2899

time_nanosleep — 수초 및 나노 초 동안 지연

 

설명 ¶

 

mixed time_nanosleep ( int $seconds , int $nanoseconds )

 

지정된 초 수 및 나노초 동안 프로그램 실행을 지연합니다.

 

인수 ¶

 

seconds

음수가 아닌 정수 여야합니다.

 

nanoseconds

10 억 미만의 음수가 아닌 정수 여야합니다.

 

반환값 ¶

 

성공 시 TRUE를, 실패 시 FALSE를 반환합니다.

 

 

지연이 신호에 의해 인터럽트되면 연관 배열이 다음 구성 요소와 함께 반환됩니다.

 

seconds - 지연 시간 (초)

nanoseconds - 지연 내에 남아있는 나노초의 수

 

Example #1 time_nanosleep() example

 

<?php

 

// 조심해! 배열이 반환되면 예상대로 작동하지 않습니다.

 

if (time_nanosleep(0, 500000000)) {

    echo "Slept for half a second.\n";

}

 

// This is better:

if (time_nanosleep(0, 500000000) === true) {

    echo "Slept for half a second.\n";

}

 

// And this is the best:

$nano = time_nanosleep(2, 100000);

 

if ($nano === true) {

    echo "Slept for 2 seconds, 100 microseconds.\n";

} elseif ($nano === false) {

    echo "Sleeping failed.\n";

} elseif (is_array($nano)) {

    $seconds = $nano['seconds'];

    $nanoseconds = $nano['nanoseconds'];

    echo "Interrupted by a signal.\n";

    echo "Time remaining: $seconds seconds, $nanoseconds nanoseconds.";

}

?>

|
댓글을 작성하시려면 로그인이 필요합니다.

개발자팁

5,403건

개발과 관련된 유용한 정보를 공유하세요. 질문은 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
PHP 17-02-11 조회 3,192
PHP 17-02-11 조회 3,314
PHP 17-02-11 조회 2,977
기타 17-02-10 조회 3,125
OS 17-02-09 조회 3,138
기타 17-02-09 조회 3,051
OS 17-02-09 조회 3,531
PHP 17-02-07 조회 3,350
PHP 17-02-07 조회 3,485
PHP 17-02-07 조회 2,909
PHP 17-02-06 조회 3,042
PHP 17-02-06 조회 2,980
PHP 17-02-06 조회 2,997
PHP 17-02-04 조회 3,284
PHP 17-02-04 조회 2,445
PHP 17-02-04 조회 2,620
PHP 17-02-03 조회 2,369
PHP 17-02-03 조회 2,792
PHP 17-02-03 조회 2,434
PHP 17-02-02 조회 2,815
PHP 17-02-02 조회 3,210
PHP 17-02-02 조회 2,909
PHP 17-01-31 조회 2,900
PHP 17-01-31 조회 3,209
PHP 17-01-31 조회 2,383
PHP 17-01-27 조회 2,539
PHP 17-01-27 조회 2,745
PHP 17-01-27 조회 2,829
PHP 17-01-26 조회 2,828
PHP 17-01-26 조회 2,767