-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
sthagen/golang-go
#163Milestone
Description
What version of Go are you using (go version)?
go 1.12
Does this issue reproduce with the latest release?
yes.
What operating system and processor architecture are you using (go env)?
linux amd64
What did you do?
I added the api reset function.
What did you expect to see?
I hope that the proposal will take effect,because sometimes we need to adjust the time dynamically.
This is not a problem,this is just a suggestion.
Please read the following.thanks.
api:
// Reset duration to reset a ticker.
func (t *Ticker) Reset(d Duration) bool {
if t.r.f == nil {
panic("time: Reset called on uninitialized Ticker")
}
w := when(d)
active := stopTimer(&t.r)
t.r.when = w
t.r.period = int64(d)
startTimer(&t.r)
return active
}