컴

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

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

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,189
PHP 17-02-11 조회 3,308
PHP 17-02-11 조회 2,972
기타 17-02-10 조회 3,124
OS 17-02-09 조회 3,133
기타 17-02-09 조회 3,049
OS 17-02-09 조회 3,527
PHP 17-02-07 조회 3,347
PHP 17-02-07 조회 3,482
PHP 17-02-07 조회 2,907
PHP 17-02-06 조회 3,040
PHP 17-02-06 조회 2,977
PHP 17-02-06 조회 2,994
PHP 17-02-04 조회 3,281
PHP 17-02-04 조회 2,443
PHP 17-02-04 조회 2,618
PHP 17-02-03 조회 2,367
PHP 17-02-03 조회 2,789
PHP 17-02-03 조회 2,432
PHP 17-02-02 조회 2,811
PHP 17-02-02 조회 3,207
PHP 17-02-02 조회 2,907
PHP 17-01-31 조회 2,897
PHP 17-01-31 조회 3,206
PHP 17-01-31 조회 2,381
PHP 17-01-27 조회 2,537
PHP 17-01-27 조회 2,743
PHP 17-01-27 조회 2,824
PHP 17-01-26 조회 2,825
PHP 17-01-26 조회 2,764