> On Sun, Sep 15, 2013 at 6:59 PM, Charles DeRykus <dery...@gmail.com> > wrote: left: ", $start+$sleep -time() }; > ...
Actually, this is wrong because if sleep(3) is interrupted by any signal it will return, so something like this should work, eg my $secs_to_sleep = 60; my $start = time(); my $end = $start + $secs_to_sleep; my $slept; do { local $SIG{USR1} = sub{ say "time left: ", $end - time()}; my $slept = sleep($secs_to_sleep); $secs_to_sleep -= $slept; } while ( $secs_to_sleep > 0 ); -- Charles DeRykus