Skip to content

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

@dsnet

Description

@dsnet

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions