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
Milestone

Comments

@cespare
Copy link
Contributor

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 commented Feb 8, 2017

Do we need Round as well, then?

@rogpeppe
Copy link
Contributor

rogpeppe commented Feb 8, 2017

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

@rsc
Copy link
Contributor

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

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

@golang golang locked and limited conversation to collaborators Feb 14, 2018
@rsc rsc unassigned cespare Jun 23, 2022
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

4 participants