You can do it without % 1, sure. It is there to make it easier to see the drift with your eyes, but you can see it without it.
> The occasional extra .01 seconds is expected, as we sleep for 'at least' .1 seconds and can't be super exact. Sure, but there is no 「sleep」 in Supply.interval(1) example (except for the one that sleeps forever). My point is that Supply.interval() drifts. Yes, by a small amount of 1 ms each tick, but drifts nonetheless. I am not sure what TimToady meant here: http://irclog.perlgeek.de/perl6/2016-08-09#i_12994683 but it sounds like there must be some Supply feature that does not drift. If it is not Supply.interval(), then what is it? On Fri, Aug 12, 2016 at 6:11 AM, Zoffix Znet via RT < perl6-bugs-follo...@perl.org> wrote: > On Tue Aug 09 14:36:10 2016, alex.jakime...@gmail.com wrote: > > Code: > > Supply.interval(1).tap: {say (now - BEGIN now) % 1}; sleep ∞ > > > > Result: > > 0.0304637 > > 0.03055483 > > 0.0314534 > > 0.0325942 > > 0.03372027 > > 0.0340993 > > 0.0352113 > > 0.036300 > > 0.0373585 > > 0.03846543 > > 0.0395657 > > 0.0406380 > > 0.04169298 > > 0.0428189 > > 0.0439086 > > … > > > > > > In this case it is about 1ms per second, which is probably very bad. > > Is there > > any reason for it to do so? > > As a user, I expect it not to drift. > > Are you sure it's not just an artifact of your measurement method? I'm not > even sure what it's measuring. > > Compare these: > > perl6 -e 'for ^Inf { sleep .1; say (now - BEGIN now) % 1 }' > > Shows your "drift" that wobbles between 0.1 and 0.9 seconds. > > perl6 -e 'for ^Inf { sleep .1; say now - BEGIN now }' > > Shows all the values incrementing by .1 seconds, no drifts, as is proper. > The occasional extra .01 seconds is expected, as we sleep for 'at least' .1 > seconds and can't be super exact. >