Johan,

For https://play.golang.com/p/Kdg-xwmquQO, timer has expired and Reset 
schedules f to run again and returns false.

Documentation reference: https://pkg.go.dev/time#Timer.Reset

Reset changes the timer to expire after duration d. It returns true if the 
timer had been active, false if the timer had expired or been stopped.

For a Timer created with AfterFunc(d, f), Reset either reschedules when f 
will run, in which case Reset returns true, or schedules f to run again, in 
which case it returns false.

Peter

On Wednesday, July 5, 2023 at 5:33:46 PM UTC-4 Johan Bolmsjö wrote:

> Hello,
>
> By accident I came across the statement "Timer type represents a single 
> event" when seeking inspiration for a timer implementation.
> I wonder if this is true with the Timer.Reset method in mind, illustrated 
> by https://play.golang.com/p/Kdg-xwmquQO.
>
> This is probably the least important topic of the year but I hesitated 
> creating a ticket for it as I'm not sure my idea of an event is what the 
> comment refers to.
>
> Documentation reference: https://pkg.go.dev/time#Timer
>
> All the best,
> Johan B
>

-- 
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/ae4bbc0a-d97f-4c27-894c-1968d0a97f16n%40googlegroups.com.

Reply via email to