Skip to content

Add directive to decode/unmarshal to UTC#392

Merged
klauspost merged 1 commit intotinylib:masterfrom
klauspost:time-utc
May 13, 2025
Merged

Add directive to decode/unmarshal to UTC#392
klauspost merged 1 commit intotinylib:masterfrom
klauspost:time-utc

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