Elapsed microtime counter
Counts the elapsed seconds when doing some process.
// mt_get: returns the current microtime function mt_get(){ global $mt_time; list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } // mt_start: starts the microtime counter function mt_start(){ global $mt_time; $mt_time = mt_get(); } // mt_end: calculates the elapsed time function mt_end($len=4){ global $mt_time; $time_end = mt_get(); return round($time_end - $mt_time, $len); }
Author:
Jonas John
License:
Public Domain
Language:
PHP
Created:
05/26/2006
Updated:
05/26/2006
Tags:
debug, time functions
Sorry folks, comments have been deactivated for now due to the large amount of spam.
Please try to post your questions or problems on a related programming board, a suitable mailing list, a programming chat-room,
or use a QA website like stackoverflow because I'm usually too busy to answer any mails related
to my code snippets. Therefore please just mail me if you found a serious bug... Thank you!
Older comments: