Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timestamp is a 64-bit integer #64

Closed
carlhoerberg opened this issue May 2, 2017 · 1 comment
Closed

Timestamp is a 64-bit integer #64

carlhoerberg opened this issue May 2, 2017 · 1 comment

Comments

@carlhoerberg
Copy link
Contributor

@carlhoerberg 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.

At

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.

@michaelklishin
Copy link
Member

@michaelklishin michaelklishin commented May 2, 2017

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

jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Jun 5, 2017
## 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.