Timestamp is a 64-bit integer #64

carlhoerberg opened this Issue May 2, 2017 · 1 comment


None yet
2 participants

carlhoerberg commented May 2, 2017

Timestamps are encoded as 64bit integers but are here decoded as two 32 bit numbers. Normally this works well when the timestamp is a 32bit number, but not when it has millisecond precision.


timestamp = data.slice(offset, 8).unpack(PACK_UINT32_X2).last

instead of

timestamp = data.slice(offset, 8).unpack(PACK_UINT32_X2).last

we should do

timestamp = data.slice(offset, 8).unpack("Q>").first

And at encoding:

UINT64 = "Q".freeze

UINT64 = "Q>".freeze

To do big-endian (network-endian) encoding and not platform/native endian.


This comment has been minimized.

Show comment
Hide comment

michaelklishin May 2, 2017


@carlhoerberg thank you. Can you please submit a PR?


michaelklishin commented May 2, 2017

@carlhoerberg thank you. Can you please submit a PR?

@michaelklishin michaelklishin closed this in #65 May 3, 2017

jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Jun 5, 2017

Update ruby-amq-protocol to 2.2.0.
## Changes between 2.1.0 and 2.2.0 (unreleased)

### Timestamps are Encoded as 64-bit Unsigned Integers

This is a potentially **breaking change**. It is recommended that
all applications that use this gem and pass date/time values in message
properties or headers are upgraded at the same time.

GitHub issue: [#64](ruby-amqp/amq-protocol#64).

Contributed by Carl Hoerberg.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment