>>/9878/
What am I doing wrong here?
Normal byte order
> $ echo bd92 | xxd -p -r - | xxd -b -
> 00000000: 10111101 10010010
> $ echo 40fa | xxd -p -r - | xxd -b -
> 00000000: 01000000 11111010
Decode:
> mtime
> Bits 00-04: seconds divided by 2
10111 -> 23
> Bits 05-10: minute
101100 -> 44
> Bits 11-15: hour
10010 -> 18
> mdate
> Bits 00-04: day
01000 -> 8
> Bits 05-08: month
0001 -> 1
> Bits 09-15: years from 1980
1111010 -> 122 (not less than 2020)
----
Reverse byte order (default in ZIP):
> $ echo 92bd | xxd -p -r - | xxd -b - # mtime
> 00000000: 10010010 10111101
> $ echo fa40 | xxd -p -r - | xxd -b - # mdate
> 00000000: 11111010 01000000
Decode:
> mtime
> Bits 00-04: seconds divided by 2
10010 -> 18 or 6
> Bits 05-10: minute
010101 -> 21
> Bits 11-15: hour
11101 -> 29 (not less than 25)
> mdate
> Bits 00-04: day
11111 -> 31
> Bits 05-08: month
0100 -> 4
> Bits 09-15: years from 1980
1000000 -> 64 (not less than 2020)
----
How:
https://www.baeldung.com/linux/convert-binary-hex-decimal
> bin_number="$1"
> hex_number=$(printf "%x" "$((2#$bin_number))")
> dec_number=$(printf "%d" "$((2#$bin_number))")
> printf "%d" "$((2#10111))"
HTTP:
> 100015 - nuzzling rainbow_dash nuzzle SoarinDash Soarin' shipping.png
> Modify: 2012-07-26 22:44:36.000000000 +0000