ksuid icon indicating copy to clipboard operation
ksuid copied to clipboard

Incorrect decode timestamp implementation

Open Marc-Ducret opened this issue 4 years ago • 0 comments

The current code:

private long decodeTimestamp(final byte[] decodedKsuid) {
    final byte[] timestamp = new byte[TIMESTAMP_LENGTH];
    System.arraycopy(decodedKsuid, 0, timestamp, 0, TIMESTAMP_LENGTH);

    return ByteBuffer.wrap(timestamp).getInt() + EPOCH;
}

The timestamp is however an unsigned 32 bit integer while here it is read as a signed 32 bit integer. Source

Marc-Ducret avatar Sep 22 '20 08:09 Marc-Ducret