diff --git a/app/helpers.php b/app/helpers.php index bd3251d..4c44878 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -11,11 +11,13 @@ if (! function_exists('crc16')) { function crc16($data): int { $crc = 0x0000; + for ($i = 0; $i < strlen($data); $i++) { $x = (($crc >> 8) ^ ord($data[$i])) & 0xFF; $x ^= $x >> 4; $crc = (($crc << 8) ^ ($x << 12) ^ ($x << 5) ^ $x) & 0xFFFF; } + return $crc; } } @@ -121,7 +123,7 @@ if (! function_exists('timew')) { } } -if (! function_exists('dwtime')) { +if (! function_exists('wtime')) { /** * Convert a 40 bit integer into a time. * @see timew()