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: Reminder to change Time.nsec from uintptr to int32 #7664

gopherbot opened this issue Mar 30, 2014 · 4 comments

time: Reminder to change Time.nsec from uintptr to int32 #7664

gopherbot opened this issue Mar 30, 2014 · 4 comments


Copy link

@gopherbot gopherbot commented Mar 30, 2014

by Matthew.Ickstadt:

I noticed a TODO in time.go which was still present in 1afdecdd77c1:

type Time struct {
        // sec gives the number of seconds elapsed since
        // January 1, year 1 00:00:00 UTC.
        sec int64

        // nsec specifies a non-negative nanosecond
        // offset within the second named by Seconds.
        // It must be in the range [0, 999999999].
        // It is declared as uintptr instead of int32 or uint32
        // to avoid garbage collector aliasing in the case where
        // on a 64-bit system the int32 or uint32 field is written
        // over the low half of a pointer, creating another pointer.
==>     // TODO(rsc): When the garbage collector is completely
==>     // precise, change back to int32.
==>     nsec uintptr

        // loc specifies the Location that should be used to
        // determine the minute, hour, month, day, and year
        // that correspond to this Time.
        // Only the zero Time has a nil Location.
        // In that case it is interpreted to mean UTC.
        loc *Location

Now that the GC completely precise, I'm assuming this minor change can be made.
Copy link

@bradfitz bradfitz commented Mar 30, 2014

Comment 1:

Labels changed: added release-go1.3maybe, repo-main.

Owner changed to @rsc.

Status changed to Accepted.

Copy link

@minux minux commented Mar 30, 2014

Comment 2:

no much benefit to switch to uint32 in terms of memory savings.
i think we can just remove the comments.
Copy link

@alberts alberts commented Apr 1, 2014

Comment 3:

Duplicate of issue #7446.
Copy link

@rsc rsc commented Apr 1, 2014

Comment 4:

Status changed to Duplicate.

Merged into issue #7446.

@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@rsc rsc removed the release-go1.3maybe label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
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.