Bug #79030 [Opn->Nab]: $_SERVER['REQUEST_TIME_FLOAT'] and microtime(TRUE) combination problem
| From: | requinix@php.net | Date: | Wed, 25 Dec 2019 09:12:46 +0000 |
| Subject: | Bug #79030 [Opn->Nab]: $_SERVER['REQUEST_TIME_FLOAT'] and microtime(TRUE) combination problem | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-224526@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79030&edit=1
ID: 79030
Updated by: requinix@php.net
Reported by: herbert at groot dot jebbink dot nl
Summary: $_SERVER['REQUEST_TIME_FLOAT'] and microtime(TRUE)
combination problem
-Status: Open
+Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: ChromeOS / Crostini / Debian 10
PHP Version: 7.4.1
Block user comment: N
Private report: N
New Comment:
Those two are backed by gettimeofday(2), which is not suitable for measuring time intervals to
sub-millisecond precision.
Previous Comments:
------------------------------------------------------------------------
[2019-12-25 06:56:21] herbert at groot dot jebbink dot nl
Description:
------------
Sometimes the $_SERVER['REQUEST_TIME_FLOAT'] and microtime(TRUE) combination gives strange
results.
Below example gives about 1 in 10 times a negative result.
Test script:
---------------
<?php
$script1 = microtime(TRUE);
$script2 = file_get_contents('http://localhost/script2.php');
echo $script2 - $script1;
?>
<?php
echo $_SERVER['REQUEST_TIME_FLOAT'];
?>
Expected result:
----------------
0.00038409233093262
Actual result:
--------------
-0.00039100646972656
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79030&edit=1