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: now.Before(time.Unix(math.MaxInt64, 0)) should return true #6210

gopherbot opened this issue Aug 21, 2013 · 6 comments

time: now.Before(time.Unix(math.MaxInt64, 0)) should return true #6210

gopherbot opened this issue Aug 21, 2013 · 6 comments


Copy link

@gopherbot gopherbot commented Aug 21, 2013


Before filing a bug, please check whether it has been fixed since the
latest release. Search the issue tracker and check that you're running the
latest version of Go:

Run "go version" and compare against  If a newer version of Go exists,
install it and retry what you did to reproduce the problem.


What steps will reproduce the problem?
If possible, include a link to a program on
1. run program at

What is the expected output?
"Cool, not the end of the world yet"

What do you see instead?
"uh oh"

Which compiler are you using (5g, 6g, 8g, gccgo)?

Which operating system are you using?
darwin (Mac OS X 10.8.4

Which version are you using?  (run 'go version')
go version go1.1.2 darwin/amd64

Please provide any additional information below.
Subtracting 1 or 1000 from MaxInt64 does not change the behavior.  Dividing by 2 does
however suggesting time.Time cannot accommodate the last bit (before the sign) of int64
when converting from unix epoch time.
Copy link

@remyoudompheng remyoudompheng commented Aug 21, 2013

Comment 1:

This falls into the general topic of integer overflow handling in time package.
Copy link

@robpike robpike commented Aug 24, 2013

Comment 2:

As Rémy says, there are overflow issues in the implementation of the time package.  A
comprehensive analysis is required.
But also: to avoid overflow the package sometimes clamps values, which can lead to
surprises too, especially if such values are then used in arithmetic.
It might be necessary to rethink the internals a bit.

Labels changed: added priority-later, removed priority-triage.

Status changed to Accepted.

Copy link

@rsc rsc commented Nov 27, 2013

Comment 3:

Labels changed: added go1.3maybe.

Copy link

@rsc rsc commented Dec 4, 2013

Comment 4:

Labels changed: added release-none, removed go1.3maybe.

Copy link

@rsc rsc commented Dec 4, 2013

Comment 5:

Labels changed: added repo-main.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
Copy link

@bradfitz bradfitz commented Feb 2, 2017

Fixed by documentation in f3fc8b0 and 526b501 for #10906

@bradfitz bradfitz closed this Feb 2, 2017
@bradfitz bradfitz added the Go2 label Feb 2, 2017
@golang golang locked and limited conversation to collaborators Feb 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.