Skip to content

Direct msgp to decode time.Time in UTC for all time values #385

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

marktheunissen
Copy link
Contributor

Currently the node your admin request hits will return UTC, but every other node will return .Local() timezone:

❯ mc admin heal vms --json | jq . |  grep last_update
              "last_update": "2025-05-07T12:17:19.098791885Z",
              "last_update": "2025-05-07T14:17:19.074143691+02:00",
              "last_update": "2025-05-07T14:17:18.015376327+02:00",
              "last_update": "2025-05-07T12:17:19.101336448Z",
              "last_update": "2025-05-07T14:17:19.078391397+02:00",
              "last_update": "2025-05-07T14:17:18.009332111+02:00",

After:

❯ mc admin heal vms --json | jq . |  grep last_update
              "last_update": "2025-05-07T12:55:17.304706378Z",
              "last_update": "2025-05-07T12:55:17.331246424Z",
              "last_update": "2025-05-07T12:55:17.333792588Z",
              "last_update": "2025-05-07T12:55:17.305889423Z",
              "last_update": "2025-05-07T12:55:17.332239139Z",
              "last_update": "2025-05-07T12:55:17.334615298Z",

@marktheunissen marktheunissen self-assigned this May 7, 2025
@marktheunissen marktheunissen added the bug Something isn't working label May 7, 2025
@@ -4,6 +4,8 @@ go 1.24.0

toolchain go1.24.2

replace github.com/tinylib/msgp v1.2.5 => github.com/klauspost/msgp v1.1.6-0.20250506154734-b646eabda3d7
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Remove me.

@klauspost
Copy link
Contributor

👍🏼 tinylib/msgp#392 is the upstream change.

AIStor should probably have the same treatment.

@vadmeste
Copy link
Member

vadmeste commented May 7, 2025

@marktheunissen I do not fully understand the issue, does msgp strip the timezone information when marshalling it ?if yes, this means minio and mc should be compatible, right ? if that is the case, we need to release mc shortly after we release the server.

@klauspost
Copy link
Contributor

klauspost commented May 7, 2025

@vadmeste The absolute time is the same. Msgpack timestamps (neither format) transmit timezone.

It is just a matter of which timezone is "attached" to the decoded time.Time, which will then produce different output when printed to text.

There is no difference to what is transmitted over the wire.

That is in contrast to JSON that preserves the timezone, therefore things serialized to JSON will contain the timezone set on the time.Time

@vadmeste
Copy link
Member

vadmeste commented May 7, 2025

Understood, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants