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

Closed
gopherbot opened this issue Aug 21, 2013 · 6 comments
Closed

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

gopherbot opened this issue Aug 21, 2013 · 6 comments
Labels
FrozenDueToAge v2 An incompatible library change
Milestone

Comments

@gopherbot
Copy link
Contributor

by tim.olsen@10gen.com:

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
http://golang.org/doc/devel/release.html  If a newer version of Go exists,
install it and retry what you did to reproduce the problem.

Thanks.

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. run program at http://play.golang.org/p/cvez19tXfE

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)?
6g

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.
@remyoudompheng
Copy link
Contributor

Comment 1:

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

@robpike
Copy link
Contributor

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.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 3:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 4:

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

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 5:

Labels changed: added repo-main.

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

bradfitz commented Feb 2, 2017

Fixed by documentation in f3fc8b0 and 526b501 for #10906

@bradfitz bradfitz closed this as completed Feb 2, 2017
@bradfitz bradfitz added the v2 An incompatible library change 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.
Labels
FrozenDueToAge v2 An incompatible library change
Projects
None yet
Development

No branches or pull requests

5 participants