File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Symfony \Polyfill \Php73 ;
4
+
5
+ /**
6
+ * @author Gabriel Caruso <[email protected] >
7
+ * @author Ion Bazan <[email protected] >
8
+ *
9
+ * @internal
10
+ */
11
+ final class Php73
12
+ {
13
+ public static $ startAt = 1533462603 ;
14
+
15
+ /**
16
+ * @param bool $asNum
17
+ *
18
+ * @return array|float|int
19
+ */
20
+ public static function hrtime ($ asNum = false )
21
+ {
22
+ $ ns = \microtime (false );
23
+ $ s = \strstr ($ ns , ' ' ) - self ::$ startAt ;
24
+ $ ns = 1E9 * (float ) $ ns ;
25
+
26
+ if ($ asNum ) {
27
+ $ ns += $ s * 1E9 ;
28
+
29
+ return \PHP_INT_SIZE === 4 ? $ ns : (int ) $ ns ;
30
+ }
31
+
32
+ return array ($ s , (int ) $ ns );
33
+ }
34
+ }
Original file line number Diff line number Diff line change 9
9
* file that was distributed with this source code.
10
10
*/
11
11
12
+ use Symfony \Polyfill \Php73 as p ;
13
+
12
14
if (PHP_VERSION_ID < 70300 ) {
13
15
if (!function_exists ('is_countable ' )) {
14
16
function is_countable ($ var ) { return is_array ($ var ) || $ var instanceof Countable || $ var instanceof ResourceBundle || $ var instanceof SimpleXmlElement; }
15
17
}
18
+
19
+ if (!function_exists ('hrtime ' )) {
20
+ p \Php73::$ startAt = (int ) microtime (true );
21
+ function hrtime ($ asNum = false ) { return p \Php73::hrtime ($ asNum ); }
22
+ }
16
23
}
You can’t perform that action at this time.
0 commit comments