Re: [go-nuts] dynamic frequency ticker

2016-08-30 Thread seb . stark
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 t

Re: [go-nuts] dynamic frequency ticker

2016-08-30 Thread seb . stark
Interesting. But it would give me two interfering frequencies at the same time, which is not what I want. Also it feels inflexible that for every possible frequency I would have to hardcode a separate select branch. Thanks anyway. Am Dienstag, 30. August 2016 21:46:46 UTC+2 schrieb freeformz:

Re: [go-nuts] dynamic frequency ticker

2016-08-30 Thread Edward Muller
How about something like this? https://play.golang.org/p/U50n3cqIXg On Tue, Aug 30, 2016 at 12:42 PM Aaron Cannon < cann...@fireantproductions.com> wrote: > How about creating a custom ticker that uses time.Sleep. There might > be some hidden caveats when using time.Sleep verses a real ticker th

Re: [go-nuts] dynamic frequency ticker

2016-08-30 Thread 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.

[go-nuts] dynamic frequency ticker

2016-08-30 Thread seb . stark
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 tel