X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FTimer.pm;h=e0f760b857a576708c60a01d9fe74a6a58b0a73f;hb=4e91a71498653a4033c42440b225245387d7f5da;hp=60ef387717f74700569c72efcb3a88b6f3e2932a;hpb=7b9256ceade8b18b48f848c9ac659c2de7322b0b;p=spider.git diff --git a/perl/Timer.pm b/perl/Timer.pm index 60ef3877..e0f760b8 100644 --- a/perl/Timer.pm +++ b/perl/Timer.pm @@ -3,7 +3,7 @@ # # This uses callbacks. BE CAREFUL!!!! # -# $Id$ +# # # Copyright (c) 2001 Dirk Koopman G1TLH # @@ -23,11 +23,11 @@ sub new my ($pkg, $time, $proc, $recur) = @_; my $obj = ref($pkg); my $class = $obj || $pkg; - my $self = bless { t=>$time + time, proc=>$proc }, $class; + my $self = bless { t=>$time + $main::systime, proc=>$proc }, $class; $self->{interval} = $time if $recur; push @timerchain, $self; - $notimers++; - dbg("Timer created ($notimers)") if isdbg('connll'); + $notimers = @timerchain; + dbg("Timer created (notimers: $notimers)") if isdbg('connll'); return $self; } @@ -36,11 +36,13 @@ sub del my $self = shift; delete $self->{proc}; @timerchain = grep {$_ != $self} @timerchain; + $notimers = @timerchain; + dbg("Timer deleted (notimers: $notimers)") if isdbg('connll'); } sub handler { - my $now = time; + my $now = $main::systime; return unless $now != $lasttime; @@ -59,6 +61,5 @@ sub handler sub DESTROY { dbg("timer destroyed ($Timer::notimers)") if isdbg('connll'); - $Timer::notimers--; } 1;