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: add Duration.Truncate #18996

Closed
cespare opened this issue Feb 8, 2017 · 4 comments
Closed

time: add Duration.Truncate #18996

cespare opened this issue Feb 8, 2017 · 4 comments
Assignees
Milestone

Comments

@cespare
Copy link
Contributor

@cespare cespare commented Feb 8, 2017

See @rsc's comment at #18991 (comment).

I was thinking of adding:

// Truncate returns the result of rounding d towards zero
// to a multiople of td.
func (d Duration) Truncate(td Duration) Duration

I'll send a CL but I want to make sure this looks good.

@cespare
Copy link
Contributor Author

@cespare cespare commented Feb 8, 2017

Do we need Round as well, then?

@rogpeppe
Copy link
Contributor

@rogpeppe rogpeppe commented Feb 8, 2017

Yeah, if we have Truncate, I reckon we should have Round too.

@rsc
Copy link
Contributor

@rsc rsc commented Feb 9, 2017

Yes, Duration and Round together please. Let's call the parameter some single letter, like m (as in "multiple of m").

@gopherbot
Copy link

@gopherbot gopherbot commented Feb 9, 2017

CL https://golang.org/cl/36615 mentions this issue.

@gopherbot gopherbot closed this in 45356c1 Feb 14, 2017
@golang golang locked and limited conversation to collaborators Feb 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

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