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

Comments

Projects
None yet
4 participants
@cespare
Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor Author

commented Feb 8, 2017

Do we need Round as well, then?

@rogpeppe

This comment has been minimized.

Copy link
Contributor

commented Feb 8, 2017

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

@rsc

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link

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.
You can’t perform that action at this time.