Cool, makes sense. Assuming NewTicker does return monotonic time. I wonder if there is a way to verify.
On Wednesday, June 10, 2020 at 5:04:24 PM UTC-6, Ian Lance Taylor wrote: > > On Wed, Jun 10, 2020 at 3:48 PM Curtis Paul <curti...@gmail.com > <javascript:>> wrote: > > > > It sounds like NewTicker will dynamically adjust to keep tick time > "accurate". > > > > Does anyone know if the time data that NewTicker returns (i.e. via it's > channel, etc...) includes monotonic time? > > And if so is the definition of NewTicker referring to adjusting real > time clock or monotonic clock? > > > > I'm not really sure what to expect with using ticker in terms of timing > accuracy. > > Is NewTicker() monotonic? > > Tickers use the monotonic clock. > > > > Also not quite sure what "Stop the ticker to release associated > resources" refers to. > > > > time.NewTicker() > > > > "NewTicker returns a new Ticker containing a channel that will send the > time with a period specified by the duration argument. It adjusts the > intervals or drops ticks to make up for slow receivers. The duration d must > be greater than zero; if not, NewTicker will panic. Stop the ticker to > release associated resources." > > In the current implementations of Go, Tickers are not garbage > collected. They run until they are stopped. So if you don't stop a > ticker, it will keep ticking until your program exits. > > (It is possible that future implementations will garbage collect > Tickers, but it still won't hurt to stop a ticker that you no longer > need.) > > Ian > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/dbcf834c-381e-43da-9318-2e18de5e5753o%40googlegroups.com.