|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-03-03 06:02 UTC] noah at rave dot ca
Description: ------------ When subtracting endtime from start time gets a negative number... Reproduce code: --------------- <? $start_time = microtime(); $end_time = microtime(); $run_time = $time_end - $start_time; echo '[' . $end_time . '] - [' . $start_time . '] = [' . $run_time . ']'; ?> Expected result: ---------------- A positive number... Actual result: -------------- [0.13353900 1172901538] - [0.13351700 1172901538] = [-0.133517] PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Mar 18 15:00:01 2026 UTC |
Actually it does sometimes return negative results... Made a typo the code... <? $start_time = microtime(); RUN QUERY $end_time = microtime(); $run_time = $end_time - $start_time; echo '[' . $end_time . '] - [' . $start_time . '] = [' . $run_time . ']'; ?> Results: [0.78013100 1172901980] - [0.64630700 1172901980] = [0.133824] [0.01399700 1172902065] - [0.88014400 1172902064] = [-0.866147] [0.87408300 1172902076] - [0.66131900 1172902076] = [0.212764] [0.46581000 1172902112] - [0.97359300 1172902111] = [-0.507783]