#44839 [Opn->Bgs]: custom timer class gives incorrect time with sleep(1);
| From: | jani@php.net | Date: | Sat, 26 Apr 2008 19:17:53 +0000 |
| Subject: | #44839 [Opn->Bgs]: custom timer class gives incorrect time with sleep(1); | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-124537@lists.php.net to get a copy of this message | ||
ID: 44839
Updated by: jani@php.net
Reported By: kjarli at gmail dot com
-Status: Open
+Status: Bogus
-Bug Type: Unknown/Other Function
+Bug Type: *General Issues
Operating System: windows xp media center
PHP Version: 5.2.5
New Comment:
Floating point values have a limited precision. Hence a value might
not have the same string representation after any processing. That also
includes writing a floating point value in your script and directly
printing it without any mathematical operations.
If you would like to know more about "floats" and what IEEE
754 is, read this:
http://docs.sun.com/source/806-3568/ncg_goldberg.html
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2008-04-26 10:48:23] kjarli at gmail dot com
Description:
------------
When I tried to benchmark my type casting tests, I found out I was
getting very, very low numbers. So I added sleep(1);
The result was nothing I expected.
Reproduce code:
---------------
All needed provided in: http://pastebin.org/32109
Expected result:
----------------
To see a time of about 1.00[0-9]* seconds.
Actual result:
--------------
about 90% of the time, the number of seconds is 0.999[0-9]*
Very wierd since I used sleep(1);
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44839&edit=1