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

Error in time.SecondsToUTC() #363

Closed
gopherbot opened this issue Dec 1, 2009 · 4 comments
Closed

Error in time.SecondsToUTC() #363

gopherbot opened this issue Dec 1, 2009 · 4 comments

Comments

@gopherbot
Copy link
Contributor

by hurtonm:

What steps will reproduce the problem?

package main

import (
        "time";
        "fmt";
)

func main() {
        t := time.SecondsToUTC(int64(-11644473600));
        fmt.Println(t);
}

What is the expected output? What do you see instead?

There is a mismatch between the output as produced by the Unix date(1)
utility and the above program.

date -u --date='@-11644473600' produces
Mon Jan  1 00:00:00 UTC 1601

./6.out produces
Mon Jan  2 00:00:00 UTC 1601

What is your $GOOS?  $GOARCH?
GOARCH=amd64
GOOS=linux

Which revision are you using?  (hg identify)

382a7bb58c03 tip
@rsc
Copy link
Contributor

rsc commented Dec 2, 2009

Comment 1:

Owner changed to r...@golang.org.

Status changed to Started.

@gopherbot
Copy link
Contributor Author

Comment 2 by cw@f00f.org:

There are other cases that break too:
     94608060 e: Sun Dec 31 00:01:00 UTC 1972   g: Sun Jan  1 00:01:00 UTC 1973
    220838460 e: Fri Dec 31 00:01:00 UTC 1976   g: Fri Jan  1 00:01:00 UTC 1977
    347068860 e: Wed Dec 31 00:01:00 UTC 1980   g: Wed Jan  1 00:01:00 UTC 1981
    473299260 e: Mon Dec 31 00:01:00 UTC 1984   g: Mon Jan  1 00:01:00 UTC 1985
    599529660 e: Sat Dec 31 00:01:00 UTC 1988   g: Sat Jan  1 00:01:00 UTC 1989
<n> = seconds since unix epoch
e = expected
g = got
(this is a slightly different bug to the one just fixed)

@rsc
Copy link
Contributor

rsc commented Dec 2, 2009

Comment 3:

http://code.google.com/p/go/source/detail?r=0465972cc0
Half of the fix.

@rsc
Copy link
Contributor

rsc commented Dec 2, 2009

Comment 4:

This issue was closed by revision 9e55d0d.

Status changed to Fixed.

Merged into issue #-.

@gopherbot gopherbot added the fixed label Dec 2, 2009
@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc removed their assignment Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants