-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Description
What version of Go are you using (go version)?
$ go version go version go1.15 darwin/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
What did you do?
package main
import (
"fmt"
"time"
)
func main() {
fmt.Println("default time", time.Time{})
if t, err := time.Parse("03:04:05.000000", "00:00:02.816500"); err != nil {
fmt.Println(err)
return
} else {
fmt.Println("parsed time: ", t, " duration: ", t.Sub(time.Time{}).Milliseconds())
}
// workaround
if t, err := time.Parse("2006-01-02 03:04:05.000000", "0001-01-01 00:00:02.816500"); err != nil {
fmt.Println(err)
return
} else {
fmt.Println("workaround parsed time: ", t, " duration: ", t.Sub(time.Time{}).Milliseconds())
}
}What did you expect to see?
Output:
default time 0001-01-01 00:00:00 +0000 UTC
parsed time: 0001-01-01 00:00:02.8165 +0000 UTC duration: 2816
workaround parsed time: 0001-01-01 00:00:02.8165 +0000 UTC duration: 2816What did you see instead?
Output:
default time 0001-01-01 00:00:00 +0000 UTC
parsed time: 0000-01-01 00:00:02.8165 +0000 UTC duration: -31622397183
workaround parsed time: 0001-01-01 00:00:02.8165 +0000 UTC duration: 2816Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.