File tree 1 file changed +16
-12
lines changed
1 file changed +16
-12
lines changed Original file line number Diff line number Diff line change 1
1
--TEST--
2
2
Bug #73837: Milliseconds in DateTime()
3
+ --SKIPIF--
4
+ <?php
5
+ if (getenv ("SKIP_SLOW_TESTS " )) die ("skip slow test " );
6
+ ?>
3
7
--FILE--
4
8
<?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 ;
12
19
}
13
20
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" ;
17
22
?>
18
23
--EXPECTF--
19
- int(%d)
20
- microseconds differ
24
+ Finished
You can’t perform that action at this time.
0 commit comments