Skip to content

time: Time.Sub regression #33677

@dsnet

Description

@dsnet

Consider the following:

func main() {
	t := time.Date(2311, 11, 26, 02, 16, 47, 63535996, time.UTC)
	u := time.Date(2019, 8, 16, 02, 29, 30, 268436582, time.UTC)

	fmt.Println(int(time.Second) + t.Nanosecond() - u.Nanosecond())
	fmt.Println(t.Sub(u))
}

On go1.12, this prints:

795099414
2562047h47m16.795099414s

On go1.13beta1, this prints:

795099414
2562047h47m16.854775807s

Notice how the nanoseconds are off? On 1.12, it is correctly .795099414, while on 1.13, it is incorrectly .854775807. This regression causes the calculation of timeouts for network connections to go wonky in RPC implementations.

The culprit for this regression is https://golang.org/cl/131196

\cc @pongad @ianlancetaylor @cybrcodr @paranoiacblack

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeSoonThis needs action soon. (recent regressions, service outages, unusual time-sensitive situations)release-blocker

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions