Yes, this probably is very ugly, but it appears to be what I'm looking for. I didn't do anything with the sign since the connection time should always be positive.
function get_float32($fp) {
// pulls a float32 from the file pointer ($fp)
$bin = '';
for($loop = 0; $loop <= 3; $loop++) {
$bin = str_pad(decbin(ord(fread($fp, 1))), 8, '0', STR_PAD_LEFT).$bin;
}
// get sign
$sign = bindec(substr($bin, 0, 1));
// get exponent and adjust for special case and bias
$exponent = bindec(substr($bin, 1, 8));
$exponent = ($exponent)? $exponent - 127 : $exponent;
if($exponent) {
// get the binary number of the mantissa
$int = bindec('1'.substr($bin, 9, $exponent));
$dec = bindec(substr($bin, 9 + $exponent));
$time = "$int.$dec";
return number_format($time / 60, 2);
} else {
return 0.0;
}
}