Port #837 from release-2.9 to master - #846
Merged
Merged
Conversation
Not affected: user apps that don't use the TimeUnixMicro option, or user apps that use the TimeUnixMicro option to encode time.Time from 1677-09-21T00:12:44Z to 2262-04-11T23:47:15.999999Z. This commit encodes time.Time with the TimeUnixMicro option as float64(Time.Unix()) + float64(Time.Nanosecond())/1e9 when the Unix seconds are outside the range where Time.UnixNano is defined for any nanosecond fraction. Times within the range are still encoded in the same way to keep encoded data unchanged from prior versions. Previously, encoding a time before 1677-09-21T00:12:43.145225Z or after 2262-04-11T23:47:16.854775Z with the TimeUnixMicro option produced data that decodes to a different time because Time.UnixNano overflows int64. For example, 9999-12-31T23:59:59Z decoded as 1816-03-30T05:56:07Z. Also, in less than one second at each end of that range (on 1677-09-21 and on 2262-04-11), some times now encode to a value nearer to the exact time: 1677-09-21T00:12:43.145225Z to 00:12:43.999999Z, and 2262-04-11T23:47:16Z to 23:47:16.854775Z.
x448
approved these changes
Oct 2, 2026
fxamacker
changed the base branch from
fxamacker/port-pr-833-to-master
to
master
October 2, 2026 05:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See PR #837 for details.