xref: /PHP-5.3/ext/standard/tests/time/001.phpt (revision d1b29ad4)
1--TEST--
2microtime() function
3--SKIPIF--
4<?php
5	if (!function_exists('microtime'))  die('skip microtime() not available');
6	die('warn system dependent');
7?>
8--FILE--
9<?php
10$passed = 0;
11$failed = 0;
12$last_m = 0;
13$last_t = 0;
14$result = '';
15
16set_time_limit(0);
17
18for ($i=1;$i<=100000;$i++) {
19	list($micro,$time)=explode(" ",microtime());
20	if ($time > $last_t || ($time == $last_t && $micro >= $last_m)) {
21		$passed++;
22	} else if ($failed++ <=10) {
23		$result .= sprintf('%06d', $i).": $time $micro < $last_t $last_m\n";
24	}
25	$last_m = $micro;
26	$last_t = $time;
27}
28echo "Passed: $passed\n";
29echo "Failed: $failed\n";
30echo $result;
31?>
32--EXPECT--
33Passed: 100000
34Failed: 0
35