From: daseymour at 3hc dot org Operating system: Windows 2000 (5.00.2195 - SP4) PHP version: 4.3.7 PHP Bug Type: Date/time related Bug description: Unix timestamp mismatch
Description: ------------ The following date/time functions give different results when requesting the current unix timestamp... Microtime() GetTimeOfDay() Time() Date() GetDate() This problem occurs on Apache 2.0.47 and Apache 1.3.31, but it doesn't seem to occur on IIS 5.0. Reproduce code: --------------- <?PHP list($tmp, $sec1) = explode(" ", microtime()); $tmp = gettimeofday(); $sec2 = $tmp['sec']; $sec3 = time(); $sec4 = date('U'); $tmp = getdate(); $sec5 = $tmp[0]; echo "These should all be the same<br /><br />"; echo "<table>"; echo "<tr><td><b>Microtime()</b>:</td><td>$sec1</td></tr>"; echo "<tr><td><b>GetTimeOfDay()</b>:</td><td>$sec2</td></tr>"; echo "<tr><td><b>Time()</b>:</td><td>$sec3</td></tr>"; echo "<tr><td><b>Date()</b>:</td><td>$sec4</td></tr>"; echo "<tr><td><b>GetDate()</b>:</td><td>$sec5</td></tr>"; echo "</table><br /><br /><hr />"; echo "<i>PHP Version: " . phpversion() . " Server API: " . php_sapi_name() . "</i>"; ?> Expected result: ---------------- The unix timestamps returned by the above functions should all be the same. Actual result: -------------- It appears that Microtime() and GetTimeOfDay() are returning different results than Time(), Date(), and GetDate(). -- Edit bug report at http://bugs.php.net/?id=29051&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29051&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29051&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=29051&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29051&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29051&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29051&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29051&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=29051&r=support Expected behavior: http://bugs.php.net/fix.php?id=29051&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=29051&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=29051&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29051&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29051&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29051&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29051&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=29051&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29051&r=float