php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64085 microtime(true) undervalued
Submitted: 2013-01-27 19:03 UTC Modified: 2013-03-07 16:28 UTC
Votes:6
Avg. Score:4.7 ± 0.7
Reproduced:5 of 5 (100.0%)
Same Version:5 (100.0%)
Same OS:5 (100.0%)
From: bugzilla77 at gmail dot com Assigned:
Status: Duplicate Package: Date/time related
PHP Version: 5.5.0alpha4 OS: Windows 7 x86/x64
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bugzilla77 at gmail dot com
New email:
PHP Version: OS:

 

 [2013-01-27 19:03 UTC] bugzilla77 at gmail dot com
Description:
------------
This bug is inaugurated in PHP 5.5: microtime(true) is undervalued up to several 
seconds!
The difference increases in time to work the server (after a few days more than 10 
seconds).
I am watching now test script -5.2 seconds, after Apache restart difference is 
positive.

I am using Apache 2.2 module on Windows 7 x86/x64.

Test script:
---------------
microtime(true): <?=$mt=microtime(true)?><br/>
time(): <?=$t=time()?><br/><br/>

microtime(true) - time(): <?=$mt-$t?><br/><br/>

difference should be greater than zero and less than one


Expected result:
----------------
PHP 5.4: microtime(true) >= time()

microtime(true): 1359313026.5983
time(): 1359313026

microtime(true) - time(): 0.59834909439087

difference should be greater than zero and less than one


Actual result:
--------------
PHP 5.5: microtime(true) < time()

microtime(true): 1359312493.8386
time(): 1359312499

microtime(true) - time(): -5.1614379882812

difference should be greater than zero and less than one


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-01-28 00:53 UTC] sixd@php.net
Regardless of whether it makes sense to compare the two functions, or regardless 
of whatever Windows system calls the two functions expose, I'd expect time1-time2 
to be negative. Please review the testcase and clarify the problem description.
 [2013-01-28 00:53 UTC] sixd@php.net
-Status: Open +Status: Feedback
 [2013-01-28 08:33 UTC] bugzilla77 at gmail dot com
Imagine that time() and microtime (true) are very similar.
The difference is the type of data returned: int and float.
The integer part must be the same them at the same moment.
Can you imagine this obviousness?

PHP 5.5 return values different by 10 seconds!
PHP 5.4 will never wrong on the same machine.
 [2013-01-28 08:33 UTC] bugzilla77 at gmail dot com
-Status: Feedback +Status: Open
 [2013-01-28 08:54 UTC] bugzilla77 at gmail dot com
The next evidence of the problem:

microtime (true) can return 10 seconds less than the value of 
$_SERVER['REQUEST_TIME_FLOAT']

Do you understand this nonsense?
...that real time from microtime(true) is 10 seconds less than request time?
 [2013-02-09 16:13 UTC] adam123 at hotmail dot com
The bug can be reproduced on Apache 2.2 + php5apache2_2.dll.
 [2013-02-09 16:29 UTC] adam123 at hotmail dot com
...and the bug can be reproduced on Apache 2.4 + php5apache2_4.dll.
 [2013-03-07 16:28 UTC] ab@php.net
-Status: Open +Status: Duplicate
 [2013-03-07 16:28 UTC] ab@php.net
Duplicate of bug #64370
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 16:01:29 2024 UTC