Skip to content

Add directive to decode/unmarshal to UTC #392

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

Merged
merged 1 commit into from
May 13, 2025

Conversation

klauspost
Copy link
Collaborator

@klauspost klauspost commented May 6, 2025

Adds //msgp:timezone utc that will decode and unmarshal to UTC time.

Default is //msgp:timezone local. If someone is feeling adventurous they can expand on these 2 settings, but this should cover 99.99% of use cases.

Avoids nasty hacks, time setting time.Local or having to do reflection to go through structs.

Went for a new function, since it was a much cleaner solution than trying to convert after reading.

Adds `//msgp:timezone utc` that will decode and unmarshal to UTC time.

Avoids nasty hacks, time setting `time.Local` or having to do reflection to go through structs.

Want for a new function, since it was a much cleaner solution than trying to convert after reading.
@marktheunissen
Copy link

+1 I've tested this and it has worked, thanks @klauspost

@klauspost klauspost merged commit f48b2ec into tinylib:master May 13, 2025
4 checks passed
@klauspost klauspost deleted the time-utc branch May 13, 2025 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants