mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
Merge branch 'PHP-8.0' into PHP-8.1
This commit is contained in:
commit
15ee285f83
@ -1,20 +1,24 @@
|
||||
--TEST--
|
||||
Bug #73837: Milliseconds in DateTime()
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$collect = [];
|
||||
|
||||
for ( $i = 0; $i < 1000; $i++ )
|
||||
{
|
||||
$a = new DateTime();
|
||||
$key = "s" . $a->format( "u" );
|
||||
$collect[$key] = true;
|
||||
$startTS = time();
|
||||
$prev_dt = new DateTime();
|
||||
while (time() < $startTS + 2) {
|
||||
$dt = new DateTime();
|
||||
if ($prev_dt > $dt) {
|
||||
var_dump($prev_dt->format("Y-m-d H:i:s.u"));
|
||||
var_dump($dt->format("Y-m-d H:i:s.u"));
|
||||
break;
|
||||
}
|
||||
$prev_dt = $dt;
|
||||
}
|
||||
|
||||
// For low-resolution clocks, we may construct many objects in the same tick.
|
||||
var_dump($n = count( $collect ));
|
||||
echo $n > 200 ? "microseconds differ\n" : "microseconds do not differ enough ($n)\n";
|
||||
echo "Finished\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(%d)
|
||||
microseconds differ
|
||||
Finished
|
||||
|
Loading…
Reference in New Issue
Block a user