function hourToSecHexBE($h, $min, $seconds) { // converts hour, min and sec to a Big endian hexadecimal // representation of the number of second // 4 hexadecimal numbers with '0' padding (at left); // $sec = hourToSec($h, $min, $seconds); $hexSec = secToHexBE($sec); return $hexSec; //return Big Endian }
function hourToSecHex($h, $min, $seconds) { // converts hour, min and sec to a little endian hexadecimal // representation of the number of second; // $sec = hourToSec($h, $min, $seconds); $hexSec = dechex($sec); $n = 4 - strlen($hexSec); for ($i = 0; $i < $n; $i++) { $hexSec = "0" . $hexSec; } $hexSecLE = substr($hexSec, 2, 2) . substr($hexSec, 0, 2); // return Little Endian return $hexSecLE; }