2 # Polled Timer handling
4 # This uses callbacks. BE CAREFUL!!!!
8 # Copyright (c) 2001 Dirk Koopman G1TLH
13 use vars qw(@timerchain $notimers);
21 my ($pkg, $time, $proc, $recur) = @_;
23 my $class = $obj || $pkg;
24 my $self = bless { t=>$time + time, proc=>$proc }, $class;
25 $self->{interval} = $time if $recur;
26 push @timerchain, $self;
28 dbg('connll', "Timer created ($notimers)");
36 @timerchain = grep {$_ != $self} @timerchain;
43 # handle things on the timer chain
45 if ($now >= $_->{t}) {
47 $_->{t} = $now + $_->{interval} if exists $_->{interval};
54 dbg('connll', "Timer destroyed ($notimers)");