R
R
rustler20002018-04-02 10:39:42
go
rustler2000, 2018-04-02 10:39:42

Is there a library for text setting intervals\delays\.. for an event to occur?

Is there a library for text setting intervals\delays\.. for an event to occur?
By type or similar:

t1 := xxxxx.NewTimer("after 1 sec", func () {})
t2 := xxxxx.NewTimes("once per 15 mins", func() {})

Although the cron format will also pull

Answer the question

In order to leave comments, you need to log in

4 answer(s)
R
RidgeA, 2018-04-02
@RidgeA

this won't work https://golang.org/pkg/time/#ParseDuration ?
well, in general, the search drives

P
Papa, 2018-04-02
Stifflera @PapaStifflera

https://github.com/jasonlvhit/gocron

E
Evgeniy Zavyalov, 2018-04-02
@profit

https://godoc.org/github.com/robfig/cron

I
irldnts, 2018-04-12
@irldnts

Depending on the complexity of the implementation, the usual infinite loop with slips may suffice

go func() {
        for {
            // do something
            // ...
            // sleep
            time.Sleep(time.Duration(15) * time.Second)
        }
}()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question