flush
[m6w6/ext-psi] / tests / time / time003.phpt
diff --git a/tests/time/time003.phpt b/tests/time/time003.phpt
new file mode 100644 (file)
index 0000000..1fe5073
--- /dev/null
@@ -0,0 +1,44 @@
+--TEST--
+nanosleep
+--SKIPIF--
+<?php
+extension_loaded("psi") or die("skip - need ext/psi");
+?>
+--ENV--
+TZ=UTC
+--INI--
+psi.directory = {PWD}
+--FILE--
+===TEST===
+<?php
+var_dump(psi\gettimeofday($tv1), $tv1);
+var_dump(psi\nanosleep(["tv_nsec" => 10000000], $rm), $rm);
+var_dump(psi\gettimeofday($tv2), $tv2);
+var_dump($tv2["tv_usec"]-$tv1["tv_usec"]);
+?>
+===DONE===
+--EXPECTF--
+===TEST===
+int(0)
+array(2) {
+  ["tv_sec"]=>
+  int(1%d)
+  ["tv_usec"]=>
+  int(%d)
+}
+int(0)
+array(2) {
+  ["tv_sec"]=>
+  int(0)
+  ["tv_nsec"]=>
+  int(0)
+}
+int(0)
+array(2) {
+  ["tv_sec"]=>
+  int(%d)
+  ["tv_usec"]=>
+  int(%d)
+}
+int(10%r\d\d\d%r)
+===DONE===