The problem I have with time.Sleep is that I am totally relying on the "exact" time guarantee a Ticker gives me. What I mean is that with a Ticker I can be sure that if it fires every 50ms, no matter what my code does (, after 10 minutes it ran exactly 12000 times. I don't know how I would do that properly with time.Sleep.
(Before somebody says now that realtime-like things won't work well with go or any garbage collected language: So far it has worked just good enough for my purposes, and I don't need more than a few ms accuracy) Am Dienstag, 30. August 2016 21:42:20 UTC+2 schrieb Aaron Cannon: > > How about creating a custom ticker that uses time.Sleep. There might > be some hidden caveats when using time.Sleep verses a real ticker that > I am unaware of, but it might meet your needs. You could then add a > custom method, or inbound channel, which you could use to tweak its > intervals on the fly. > > Aaron > > On 8/30/16, seb....@gmail.com <javascript:> <seb....@gmail.com > <javascript:>> wrote: > > In my application I select on a ticker channel, but sometimes need to > have > > the waiting time vary a bit. For not so frequent changes I could make a > new > > > > ticker everytime, but I have the feeling this is not the best solution > for > > higher frequencies and many rate changes. Best would be if I could tell > my > > existing ticker "from next tick on please use an interval of x". In fact > > what I want is that the frequency changes over time. > > > > Any tips how to achieve that? > > > > -- > > 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...@googlegroups.com <javascript:>. > > For more options, visit https://groups.google.com/d/optout. > > > -- 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. For more options, visit https://groups.google.com/d/optout.