Skip to content
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

time: Duration.String and ParseDuration do not round trip for MinInt64 #48629

Closed
dsnet opened this issue Sep 25, 2021 · 2 comments
Closed

time: Duration.String and ParseDuration do not round trip for MinInt64 #48629

dsnet opened this issue Sep 25, 2021 · 2 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@dsnet
Copy link
Member

dsnet commented Sep 25, 2021

Consider this test:

want := time.Duration(math.MinInt64)
got, err := time.ParseDuration(want.String())
if got != want || err != nil {
	t.Errorf("time.ParseDuration = (%v, %v), want (%v, nil)", got, err, want)
}

Unfortunately this test fails:

time.ParseDuration = (0s, time: invalid duration "-2562047h47m16.854775808s"), want (-2562047h47m16.854775808s, nil)
@gopherbot
Copy link

Change https://golang.org/cl/352269 mentions this issue: time: allow max negative int64 in ParseDuration

@mknyszek mknyszek added NeedsFix The path to resolution is known, but the work has not been done. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. and removed NeedsFix The path to resolution is known, but the work has not been done. labels Oct 4, 2021
@mknyszek mknyszek added this to the Backlog milestone Oct 4, 2021
@mknyszek
Copy link
Contributor

mknyszek commented Oct 4, 2021

CC @rsc via https://dev.golang.org/owners

@golang golang locked and limited conversation to collaborators Oct 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants