note 26134 added to function.microtime

From: Date: Sat, 19 Oct 2002 05:53:30 +0000
Subject: note 26134 added to function.microtime
Groups: php.notes 
Request: Send a blank email to php-notes+get-38284@lists.php.net to get a copy of this message
Simple function to return the absolute difference between two microtime strings. function microtime_diff($a,$b) { list($a_micro, $a_int)=explode(' ',$a); list($b_micro, $b_int)=explode(' ',$b); if ($a_int>$b_int) { return ($a_int-$b_int)+($a_micro-$b_micro); } elseif ($a_int==$b_int) { if ($a_micro>$b_micro) { return ($a_int-$b_int)+($a_micro-$b_micro); } elseif ($a_micro<$b_micro) { return ($b_int-$a_int)+($b_micro-$a_micro); } else { return 0; } } else { // $a_int<$b_int return ($b_int-$a_int)+($b_micro-$a_micro); } } -- http://www.php.net/manual/en/function.microtime.php http://master.php.net/manage/user-notes.php?action=edit+26134 http://master.php.net/manage/user-notes.php?action=delete+26134 http://master.php.net/manage/user-notes.php?action=reject+26134

« previous php.notes (#38284) next »