Skip to content

Commit a690a56

Browse files
committed
Merge branch 'PHP-8.1'
2 parents bf6c96a + 15ee285 commit a690a56

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

ext/date/tests/bug73837.phpt

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
--TEST--
22
Bug #73837: Milliseconds in DateTime()
3+
--SKIPIF--
4+
<?php
5+
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
6+
?>
37
--FILE--
48
<?php
5-
$collect = [];
6-
7-
for ( $i = 0; $i < 1000; $i++ )
8-
{
9-
$a = new DateTime();
10-
$key = "s" . $a->format( "u" );
11-
$collect[$key] = true;
9+
$startTS = time();
10+
$prev_dt = new DateTime();
11+
while (time() < $startTS + 2) {
12+
$dt = new DateTime();
13+
if ($prev_dt > $dt) {
14+
var_dump($prev_dt->format("Y-m-d H:i:s.u"));
15+
var_dump($dt->format("Y-m-d H:i:s.u"));
16+
break;
17+
}
18+
$prev_dt = $dt;
1219
}
1320

14-
// For low-resolution clocks, we may construct many objects in the same tick.
15-
var_dump($n = count( $collect ));
16-
echo $n > 200 ? "microseconds differ\n" : "microseconds do not differ enough ($n)\n";
21+
echo "Finished\n";
1722
?>
1823
--EXPECTF--
19-
int(%d)
20-
microseconds differ
24+
Finished

0 commit comments

Comments
 (0)