Perhaps rather than reinventing wheels use AnyEvent and EV to setup a timer event to be posted every second.
$ perl -MTime::HiRes=time -MAnyEvent -E '$quit = AnyEvent->condvar;$w += AnyEvent->timer( after => 1, interval => 1, cb => sub { state $ctr += 1; say "@{[Time::HiRes::time()]}: FOOP! $ctr"; $quit->send if 10 == + $ctr++; } );say qq{Starting loop};$quit->recv;' Starting loop 1574791289.26471: FOOP! 1 1574791290.26702: FOOP! 2 1574791291.26394: FOOP! 3 1574791292.26511: FOOP! 4 1574791293.26735: FOOP! 5 1574791294.26826: FOOP! 6 1574791295.26665: FOOP! 7 1574791296.265: FOOP! 8 1574791297.26659: FOOP! 9 1574791298.26699: FOOP! 10 $
The cake is a lie.
The cake is a lie.
The cake is a lie.
In reply to Re: The most precise second (timer)
by Fletch
in thread The most precise second (timer)
by tukusejssirs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |