We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1dc6dba commit c854bb2Copy full SHA for c854bb2
ext/date/tests/bug73837.phpt
@@ -1,19 +1,23 @@
1
--TEST--
2
Bug #73837: Milliseconds in DateTime()
3
+--SKIPIF--
4
+<?php
5
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
6
+?>
7
--FILE--
8
<?php
-$collect = [];
-
-for ( $i = 0; $i < 1000; $i++ )
-{
9
- $a = new DateTime();
10
- $key = "s" . $a->format( "u" );
11
- $collect[$key] = true;
+$startTS = time();
+$prev_dt = new DateTime();
+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;
19
}
-var_dump($n = count( $collect ));
-echo ( $n > 700 ) ? "microseconds differ\n" : "microseconds do not differ enough ($n)\n";
20
+echo "Finished\n";
21
?>
22
--EXPECTF--
-int(%d)
-microseconds differ
23
+Finished
0 commit comments