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

NatsJetStreamMetaData timestamp parsed with incorrect timezone unable to convert back to UTC #1125

Closed
mrmx opened this issue Apr 21, 2024 · 1 comment
Labels
defect Suspected defect such as a bug or regression

Comments

@mrmx
Copy link
Contributor

mrmx commented Apr 21, 2024

Observed behavior

The timestamp metadata returned to clients shows incorrect timezone offsets when reverting back to UTC (as writting normalized UTC code in server and client side).

Using the long timestamp in the JetStreamTestBase 1605139610113260000 corresponding to a
2020-11-12T00:06:50.113260Z RFC3339 it results to a ZonedDateTime of (ie)
2020-11-12T00:06:50.113260+01:00[Europe/Madrid] returned in the timestamp metadata.

Converting it back to UTC:

ZonedDateTime utcZonedDateTime = timestamp.withZoneSameInstant(ZoneId.of("UTC"));

Gives back a 2020-11-11T23:06:50.113260Z[UTC] which is wrong.

Expected behavior

The above conversion to UTC should be 2020-11-12T00:06:50.113260Z[UTC]

Server and client version

server: Synadia current Cloud NGS service (@connect.ngs.global)
client: io.nats:jnats-2.16/17.x

Steps to reproduce

Given a NATS Message's metadata timestamp:

ZonedDateTime timestamp = msg.metaData().timestamp();
ZonedDateTime utcZonedDateTime = timestamp.withZoneSameInstant(ZoneId.of("UTC"));

The converted back to UTC ZonedDateTime timestamp utcZonedDateTime is wrong.

@mrmx mrmx added the defect Suspected defect such as a bug or regression label Apr 21, 2024
@mrmx
Copy link
Contributor Author

mrmx commented Apr 21, 2024

This relates to #938

mrmx added a commit to mrmx/nats.java that referenced this issue Apr 21, 2024
…t timezone unable to convert back to UTC
@scottf scottf closed this as completed in 6f91621 Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Suspected defect such as a bug or regression
Projects
None yet
Development

No branches or pull requests

1 participant