php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80683 Untrue statement about microtime() precision
Submitted: 2021-01-28 19:03 UTC Modified: 2021-01-28 22:37 UTC
From: php4fan at gmail dot com Assigned: danack (profile)
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
27 - 7 = ?
Subscribe to this entry?

 
 [2021-01-28 19:03 UTC] php4fan at gmail dot com
Description:
------------
---
From manual page: https://php.net/function.microtime
---

It states:
"If as_float is set to true, then microtime() returns a float, which represents the current time in seconds since the Unix epoch accurate to the nearest microsecond."

That's not true. The value returned as float is not accurate to the nearest microsecond. Now I guess that's obvious if you know what the precision of a float is, but if I read a sentence that says "accurate to the nearest microsecond", I'm not going to do maths, I'll assume that who wrote the sentence already did that for me, so if they say "accurate to the nearest microsecond" I'll assume they figured out that the typical precision of a float is enough to give you a 1-microsecond precision on such a number.




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-01-28 19:08 UTC] php4fan at gmail dot com
-Status: Open +Status: Closed
 [2021-01-28 19:08 UTC] php4fan at gmail dot com
Whops, sorry, not true, I was just printing it and it got rounded when converted to string.
 [2021-01-28 19:10 UTC] danack@php.net
-Assigned To: +Assigned To: danack
 [2021-01-28 19:10 UTC] danack@php.net
Yeah, not only is it not true, it's not a useful bug report anyway.

If you think something in the manual needs improving, please submit some better words at https://github.com/php/doc-en .
 [2021-01-28 22:37 UTC] requinix@php.net
-Status: Closed +Status: Not a bug
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Sep 20 15:03:37 2021 UTC