【发布时间】:2020-06-22 06:40:50
【问题描述】:
尝试以这种方式读取以纳秒(8 字节)为单位的时间戳:
$fp = fopen($binFile, 'rb');
...
fseek($fp, $current * $event_len, SEEK_CUR);
// Read 8 bytes of timestamp apart
$ts_lo = fread($fp, 4);
$ts_hi = fread($fp, 4);
$ts = $ts_hi.$ts_lo;
$gmp = gmp_import($ts);
echo gmp_strval($gmp);
fclose($fp);
但是得到了错误的结果(比较 epochconverter.com 服务)。我怎样才能正确读取这 8 个字节?我的系统是 32bit little endian (linux arm)
【问题讨论】: