Annotation of embedaddon/php/ext/standard/tests/time/001.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: microtime() 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: 
                     16: set_time_limit(0);
                     17: 
                     18: for ($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: }
                     28: echo "Passed: $passed\n";
                     29: echo "Failed: $failed\n";
                     30: echo $result;
                     31: ?>
                     32: --EXPECT--
                     33: Passed: 100000
                     34: Failed: 0

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>