php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4968 microtime() does not work properly
Submitted: 2000-06-12 04:33 UTC Modified: 2001-02-04 10:54 UTC
From: waldschrott at kiffen dot de Assigned: jmoore (profile)
Status: Closed Package: Date/time related
PHP Version: 4.0 Latest CVS (12/06/2000) OS: win32(2000) only
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: waldschrott at kiffen dot de
New email:
PHP Version: OS:

 

 [2000-06-12 04:33 UTC] waldschrott at kiffen dot de
is microtime() supposed not to work under win32? If it is, there?s a serious bug in it. The following script works as intended (it produces no lines with an *) running on Linux - the same script under win32 fails at some points (search for "*" and exampine the values around it)...

microtime() *seems* to work under win32, it produces a string with a micro and a timestamp part, subsequent values are raising compared to the ancestor in the micro part - the timestamp part seems *not* to be incremented after the micro part exceeds 0,9(period), it is incremented from time to time - I even don?t know when, perhaps every fourth pass...

If it is not intended to work under win32 a warning should appear OR it should be implemented if possible...


<?
for ($i=1;$i<=10000;$i++)    {
list($micro,$time)=explode(" ",microtime());
$add=$micro+$time;
print ($last? ($add<$last ? '*' : '') :     '')."M\t$micro\tT\t$time\tS\t$ add<BR>";
$last=$add; }
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-01 23:49 UTC] waldschrott@php.net
wow, It still doesn?t work and crashes after a while
 [2000-09-13 21:41 UTC] dbeu@php.net
i failed to reproduce this with php 4.0.2.
does this problem still exist?
 [2000-09-13 23:43 UTC] waldschrott@php.net
the problem is still existent, try this code it?s much better:

for ($i=1;$i<=100000;$i++)    {
   list($micro,$time)=explode(" ",microtime());
   $add=$micro+$time;
   print ($add<$last ? 'Last:'.$last.' -Current:'.$add.'<BR>' : '');
   $last=$add; }
 [2000-12-19 18:55 UTC] sniper@php.net
Feedback from Cynic <cynic@mail.cz>:
----------------------------
Tested on NT 5 SP 1 Apache 1.3.15-dev / DSO PHP 4.0.5-dev from 
13.12.2000. 
It still exists.

 [2001-02-04 06:55 UTC] jmoore@php.net
Ill look into this one.

James
 [2001-02-04 10:54 UTC] jmoore@php.net
Fixed in CVS
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Oct 05 22:01:26 2024 UTC