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: Time.Before() should reuse t.sec() and u.sec() #36987

Closed
geraldss opened this issue Feb 2, 2020 · 2 comments
Closed

time: Time.Before() should reuse t.sec() and u.sec() #36987

geraldss opened this issue Feb 2, 2020 · 2 comments
Milestone

Comments

@geraldss
Copy link

@geraldss geraldss commented Feb 2, 2020

Looking at the source code for Time.After() and Time.Before(), Time.After() reuses t.sec() and u.sec(), whereas Time.Before() does not and often calls each method twice.

https://golang.org/src/time/time.go

@dmitshur dmitshur changed the title Time.Before() should reuse t.sec() and u.sec() time: Time.Before() should reuse t.sec() and u.sec() Feb 2, 2020
@ianlancetaylor ianlancetaylor added this to the Backlog milestone Feb 3, 2020
@tpaschalis
Copy link
Contributor

@tpaschalis tpaschalis commented Feb 3, 2020

I'm on it, let me wrap up a PR for this.

@gopherbot
Copy link

@gopherbot gopherbot commented Feb 3, 2020

Change https://golang.org/cl/217360 mentions this issue: time: fix time.Before to reuse t.sec()/u.sec() and not call them

@gopherbot gopherbot closed this in ff1eb42 Mar 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.