<font face="courier new,monospace">I have a scenario where I need to find out how much time<br>is remaining on a timer (so that I can perform some calculation<br>and then re-schedule something, based on that calculation).<br>
<br>How can I find out something about the timer?<br>Either when it was started, how much time has elapsed,<br>or how much time is remaining?<br><br>I tried the following test (based on what I read about EV)<br>without success.<br>
<br>use AnyEvent;<br><br> # make a long timer, and a short timer that can 'look into'<br> # the long timer to see what it can see<br><br>my $long = AnyEvent->timer(<br> after => 5,<br>
cb => sub { print "long timer done\n"; exit; }<br> );<br>my $short = AnyEvent->timer(<br> after => 2,<br> cb => sub {<br> print "time info part way through is: ",<br>
$long->at, "\n";<br> }<br> );<br><br>my $cv = AnyEvent->condvar;<br>$cv->wait;<br><br></font>