I recently came across information that on the 15th of May at 02:09:25 Unix time will be equal to 1010101010101010101010101010101
in binary representation.
I wanted to find out whether it is a fake or not, so I was trying to get the current Unix time in binary. I came up with a simple prompt like this:
$ date +%s | xxd -b
And I got a result like this:
0000000: 00110001 00110100 00110011 00110001 00110100 00110110 143146
0000006: 00110010 00110100 00110100 00110010 00001010 2442.
All in all, I got:
0011000100110100001100110011000100110100001101100011001000110100001101000011001000001010
But it shows much more digits than I expected. All the other variations were unsatisfactory as well such as $ date "+%v %H:%M:%S" | xxd -b
or $ date | xxd -b
.
I guess, this pair of date
and xxd
commands is not going to give me the expected result.
Could you tell me how can I get the current time in such a binary representation that I will get 1010101010101010101010101010101
on the 15th of May at 02:09:25?
Update:
OK, so using this online converter (http://www.mathsisfun.com/binary-decimal-hexadecimal-converter.html) I was able to get a reasonable number of digits. How can I achieve the same using bash?