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: reconsider rejection of #17601 (time: create ticker with instant first tick) #29188

Closed
s7v7nislands opened this Issue Dec 12, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@s7v7nislands
Copy link

s7v7nislands commented Dec 12, 2018

What version of Go are you using (go version)?

$ go version
go version go1.11.2 darwin/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/s7v7nislands/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/s7v7nislands/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11.2/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11.2/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/6v/g6zn4dm124v2pg2zwkw0c4t40000gn/T/go-build116331184=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

The current time.NewTicker(time.Duration) makes its first tick after the given duration. ue to the nature of most ticker-dependent implementations, it is hard to elegantly add a tick right after calling the method.

Therefore, I want to propose a new method time.NewTickerStart(time.Duration), f.e. that does exactly the same as time.NewTicker, but fires the first tick directly after creation.

What did you expect to see?

What did you see instead?

@ALTree

This comment has been minimized.

Copy link
Member

ALTree commented Dec 12, 2018

This was asked and rejected in the past, in #17601, as you noted.

rsc wrote:

This doesn't seem to rise to the level of new API. You don't have to "copy the section of code underneath the first <-t.C", you just have to put the code in its own function and call that function once at the start and once after each timeout interval. That seems clear enough.

What has changed since 2 years ago, when this was rejected? When asking to reconsider an old decision, you'll need to explain why are you hoping the answer will be different now.

@ALTree ALTree changed the title reopen #17601, time: create ticker with instant first tick time: reconsider rejection of #17601 (time: create ticker with instant first tick) Dec 12, 2018

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Jan 12, 2019

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this Jan 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment