-1

Trying to read timestamp in nanosecs(8 bytes) this way:

$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);

But got wrong result (comparing at epochconverter.com service). How can i read these 8 bytes right way? My system is 32bit little endian (linux arm)

tzi0
  • 537
  • 2
  • 5
  • 12

1 Answers1

0

Answer to myself:

gmp_strval (gmp_add (gmp_mul ($ts_hi, "4294967296"), $ts_lo)
tzi0
  • 537
  • 2
  • 5
  • 12