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

proposal: time: add time helper UnixNano(nsec) #51148

Closed
joshuamsager opened this issue Feb 11, 2022 · 1 comment
Closed

proposal: time: add time helper UnixNano(nsec) #51148

joshuamsager opened this issue Feb 11, 2022 · 1 comment

Comments

@joshuamsager
Copy link

Currently, the time package allows for converting time.Time to nanoseconds. This issue proposes a symmetrical helper that converts nanoseconds to time.Time:

The proposed API follows a similar pattern to the existing helpers: UnixMilli and UnixMicro implemented in 49dccf1:

func UnixNano(nsec int64) Time {
	return Unix(nsec/1e9, nsec%1e9)
}
@seankhliao
Copy link
Member

time.Unix(0, nsec) already works though, and is explicitly documented to work as such

@golang golang locked and limited conversation to collaborators Feb 11, 2023
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

3 participants