1--TEST-- 2time_nanosleep — Delay for a number of seconds and nanoseconds 3--SKIPIF-- 4<?php if (!function_exists('time_nanosleep')) die("skip"); 5if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); 6?> 7--CREDITS-- 8Àlex Corretgé - alex@corretge.cat 9--FILE-- 10<?php 11$nano = time_nanosleep(2, 100000); 12 13if ($nano === true) { 14 echo "Slept for 2 seconds, 100 milliseconds.\n"; 15} elseif ($nano === false) { 16 echo "Sleeping failed.\n"; 17} elseif (is_array($nano)) { 18 $seconds = $nano['seconds']; 19 $nanoseconds = $nano['nanoseconds']; 20 echo "Interrupted by a signal.\n"; 21 echo "Time remaining: $seconds seconds, $nanoseconds nanoseconds."; 22} 23?> 24--EXPECT-- 25Slept for 2 seconds, 100 milliseconds. 26