X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FTimer.pm;h=fb429f643537d40cd204b367c93ed5f962cd74df;hb=93292dcd622b1505d2cbab334277c89e7c8afd27;hp=683497d2d328f889f6d1ac6f1aaf9538587b3a4a;hpb=6624dcdf07d628e8d6a16fc6549edf40be25b7b2;p=spider.git diff --git a/perl/Timer.pm b/perl/Timer.pm index 683497d2..fb429f64 100644 --- a/perl/Timer.pm +++ b/perl/Timer.pm @@ -3,19 +3,21 @@ # # This uses callbacks. BE CAREFUL!!!! # -# $Id$ +# # # Copyright (c) 2001 Dirk Koopman G1TLH # package Timer; -use vars qw(@timerchain $notimers); +use vars qw(@timerchain $notimers $lasttime); use DXDebug; @timerchain = (); $notimers = 0; +$lasttime = 0; + sub new { my ($pkg, $time, $proc, $recur) = @_; @@ -39,7 +41,9 @@ sub del sub handler { my $now = time; - + + return unless $now != $lasttime; + # handle things on the timer chain my $t; foreach $t (@timerchain) { @@ -48,6 +52,8 @@ sub handler $t->{t} = $now + $t->{interval} if exists $t->{interval}; } } + + $lasttime = $now; } sub DESTROY