Reputation: 11
((timestamp - 1288834974657) << 32)
I included some more bits information, for example, total 32 bits after timestamp information needs, then the timestamp needs to be left shift 32 bits, such that the result exceeds long.max value. The result shown a negative value something like -7187691577906700288, it was wrong.
Hope I described my question correctly. Please help...
Upvotes: 0
Views: 271
Reputation: 99533
I don't know snowflake well (I assume it's a language?) I also don't know what format that timestamp is. If 1288834974657 a unix timestamp, it's in the year 42811.
The issue is that this particular timestamp is larger than 32bit. Since you move it up another 32bit, your number overflows. It looks like the long
in your language might be unsigned, which means that the maximum number is probably 2^63-1. If the long
were unsigned, the maximum number would probably be 2^64-1.
Upvotes: 1