Edit report at http://bugs.php.net/bug.php?id=54050&edit=1

 ID:                 54050
 Comment by:         nospam at unclassified dot de
 Reported by:        nospam at unclassified dot de
 Summary:            microtime() returns random values
 Status:             Open
 Type:               Bug
 Package:            *General Issues
 Operating System:   Windows XP
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

The seconds part of the return value seems to be my system boot time. I
have now restarted the computer and the value points to that time. The
fractional part is kind of oscillating around similar values. It's going
up and down a bit every time but it has the tendency to decrease slowly.
I have discovered a few other places in my application where it happens.
But it's always the same database function. The same code.



$start0 = microtime(true);

$start = microtime(true);

if (abs($start - $start0) > 1)

{

        var_dump($start0);

        var_dump($start);

}



This should never print something but it does. Here are a few examples:



float(1298065510.0493) float(1298068208.1106)

float(1298065510.0533) float(1298068218.7475)

float(1298065510.0405) float(1298068225.1549)

float(1298065510.038) float(1298068231.7615)

float(1298065510.0269) float(1298068237.0667)

float(1298065510.0234) float(1298068244.8534)

float(1298065510.0266) float(1298068250.9826)

float(1298065510.0145) float(1298068257.6404)

float(1298065510.8087) float(1298068265.3026)

float(1298065510.809) float(1298068271.1601)

float(1298065510.8087) float(1298068277.0327)

float(1298065510.8029) float(1298068284.6319)

...


Previous Comments:
------------------------------------------------------------------------
[2011-02-18 22:32:24] nospam at unclassified dot de

I have restarted the Apache web server and then the microtime function
worked correctly in this situation a few times. Then it started to
produce the same bogus data often. Now the original problem is right
here again. Same place. Only the approximately 100th of like 200 times
it is called. Instead of 1298064639.9228 (or similar) as everywhere else
on the page it returns values around 1296908080.167 or 1296908081.2987.
Quite a bit off but relatively "constant".

------------------------------------------------------------------------
[2011-02-18 22:17:00] nospam at unclassified dot de

Description:
------------
I have a very weird bug here. The microtime() function with the
parameter true works fine everywhere in my entire application - except
in one single place. It's measuring database query durations here. It
counts everything perfectly but always at a certain database query in
the deepest middle of my application it returns random values. When I
call it a second time just a line of code later, it returns the correct
value again. It happens every time tonight. I cannot provide a testcase
yet because there's another tens of thousands of lines of code hanging
at this to work at all.



I cannot upgrade PHP because there's no newer XAMPP package available.
Version is 5.3.1.



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=54050&edit=1

Reply via email to