public static function formatDuration($duration, $precision = 3)
    {
        if ($duration < 1) {
            $duration *= 1000;
            $unit = 'ms';
        } else {
            $unit = 's ';
        }

        return self::toPrecision($duration, $precision) . $unit;
    }
public static function formatDuration($duration, $precision = 3)
    {
        if ($duration < 1) {
            $duration *= 1000;
            $unit = 'ms';
        } else {
            $unit = 's ';
        }

        return self::toPrecision($duration, $precision) . $unit;
    }
public static function formatDuration ( $ duration , $ precision = 3 ) { if ( $ duration < 1 ) { $ duration *= 1000 ; $ unit = 'ms' ; } else { $ unit = 's ' ; } return self :: toPrecision ( $ duration , $ precision ) . $ unit ; }
Format a duration into a human-readable representation.

@param double  $duration  Duration to format, in seconds.
@param integer $precision How many decimals to include.

@return string
Format a duration into a human - readable representation .