php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #60162 Documentation Bug
Submitted: 2011-10-28 19:28 UTC Modified: 2011-11-01 22:17 UTC
From: jon at buymydreamhotel dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jon at buymydreamhotel dot com
New email:
PHP Version: OS:

 

 [2011-10-28 19:28 UTC] jon at buymydreamhotel dot com
Description:
------------
---
From manual page: http://www.php.net/function.microtime#refsect1-function.microtime-returnvalues
---

Hello, on the basis of experimentation I disagree with the wording
of the documentation for microtime. I cannot see the documentation whilst I write
this but basically the default behaviour is to split the return into the 
number of seconds since some date in the 1970s and then the other part is described as being the number of microseconds since that time indicated by the whole number of seconds.

I see numbers like this...

0.36411000 1319829349
0.42210500 1319829349

In this case the number of seconds is the same but the first part of each time shows a sub-second difference.

HOWEVER as I understand it this is NOT the number of microseconds but actually a decimal or float representation of the part that cannot be expressed as whole seconds, the numbers may indicate microseconds in the sense that they offer a certain resolution but the units here are still seconds? I can understand what the definition is attempting to say but it is inaccurate and badly expressed.

Several contributors have defined a function which is intended for users who lack the option to give the answer as a float and they simply add the first part to the second part. If the first part was actually expressed in microseconds then it would be necessary to multiply by one million to get the units into seconds before adding to the whole seconds part.

If I have mis-understood then the examples given by contributors lack a scaling value of 1 million and should be removed or corrected for clarity.





Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-01 22:17 UTC] salathe@php.net
The "return values" section of the microtime manual page makes it clear what the 
value is representing. The 0.36411000 in your first example "is the number of 
microseconds that have elapsed since sec expressed in seconds."  The important 
part here are the last three words: expressed in seconds. The microtime portion of 
the time is expressed as a decimal fraction of a second.
 [2011-11-01 22:17 UTC] salathe@php.net
-Status: Open +Status: Bogus
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Oct 10 13:00:01 2026 UTC