note 83527 added to function.microtime

From: Date: Fri, 30 May 2008 10:31:03 +0000
Subject: note 83527 added to function.microtime
Groups: php.notes 
Request: Send a blank email to php-notes+get-139994@lists.php.net to get a copy of this message
This function allows you to easily calculate time difference between two points in time without losing the precision. /** Calculate a precise time difference. @param string $start result of microtime() @param string $end result of microtime(); if NULL/FALSE/0/'' then it's now @return flat difference in seconds, calculated with minimum precision loss */ function microtime_diff( $start, $end=NULL ) { if( !$end ) { $end= microtime(); } list($start_usec, $start_sec) = explode(" ", $start); list($end_usec, $end_sec) = explode(" ", $end); $diff_sec= intval($end_sec) - intval($start_sec); $diff_usec= floatval($end_usec) - floatval($start_usec); return floatval( $diff_sec ) + $diff_usec; } ---- Server IP: 92.48.74.199 Probable Submitter: 80.169.172.66 ---- Manual Page -- http://www.php.net/manual/en/function.microtime.php Edit -- https://master.php.net/note/edit/83527 Del: integrated -- https://master.php.net/note/delete/83527/integrated Del: useless -- https://master.php.net/note/delete/83527/useless Del: bad code -- https://master.php.net/note/delete/83527/bad+code Del: spam -- https://master.php.net/note/delete/83527/spam Del: non-english -- https://master.php.net/note/delete/83527/non-english Del: in docs -- https://master.php.net/note/delete/83527/in+docs Del: other reasons-- https://master.php.net/note/delete/83527 Reject -- https://master.php.net/note/reject/83527 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#139994) next »