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

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

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,177
PHP 17-02-11 조회 3,296
PHP 17-02-11 조회 2,947
기타 17-02-10 조회 3,107
OS 17-02-09 조회 3,116
기타 17-02-09 조회 3,037
OS 17-02-09 조회 3,516
PHP 17-02-07 조회 3,333
PHP 17-02-07 조회 3,470
PHP 17-02-07 조회 2,888
PHP 17-02-06 조회 3,022
PHP 17-02-06 조회 2,965
PHP 17-02-06 조회 2,971
PHP 17-02-04 조회 3,261
PHP 17-02-04 조회 2,414
PHP 17-02-04 조회 2,591
PHP 17-02-03 조회 2,343
PHP 17-02-03 조회 2,769
PHP 17-02-03 조회 2,413
PHP 17-02-02 조회 2,792
PHP 17-02-02 조회 3,187
PHP 17-02-02 조회 2,890
PHP 17-01-31 조회 2,879
PHP 17-01-31 조회 3,189
PHP 17-01-31 조회 2,369
PHP 17-01-27 조회 2,514
PHP 17-01-27 조회 2,724
PHP 17-01-27 조회 2,808
PHP 17-01-26 조회 2,799
PHP 17-01-26 조회 2,733