jonboulle / clockwork

a fake clock for golang
Apache License 2.0
625 stars 57 forks source link

Fake clock advances past intervening timers #46

Closed muir closed 12 months ago

muir commented 1 year ago

I know that the real clock doesn't guarantee that timers will go off exactly on time, but in practice they go off somewhat close to on schedule.

I just created a pull request to add AfterFunc. I noticed when testing it that I can advance the clock well past when a timer is supposed to fire. The timer fires, but it thinks the time is well past when it should be.

So then, the question is: should the clock pause for real time as it advances past timers? I think that for AfterFunc, it should be willing to wait for f() to return or for one real second to pass, whichever comes first.

I don't think any of the other APIs provide any way to know how long to pause.

sagikazarmark commented 1 year ago

@muir can you check if the latest (0.4.0) version provides what you are asking for?

DPJacques commented 12 months ago

This is almost a year old, and sever months since our attempt to get feedback. If someone can provide reproduction steps, please feel free to reopen.