X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FTimer.pm;h=60ef387717f74700569c72efcb3a88b6f3e2932a;hb=b9dffeff7239952814342dad19db3a51def6fab7;hp=4a1e1c42e165395145eb913d124bdab2007991b9;hpb=dbf7523a9b228dbdf1d03109afde351b8b194fab;p=spider.git diff --git a/perl/Timer.pm b/perl/Timer.pm index 4a1e1c42..60ef3877 100644 --- a/perl/Timer.pm +++ b/perl/Timer.pm @@ -10,17 +10,13 @@ package Timer; -use vars qw(@timerchain $notimers); +use vars qw(@timerchain $notimers $lasttime); use DXDebug; @timerchain = (); $notimers = 0; -use vars qw($VERSION $BRANCH); -$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ ); -$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0)); -$main::build += $VERSION; -$main::branch += $BRANCH; +$lasttime = 0; sub new { @@ -45,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) { @@ -54,6 +52,8 @@ sub handler $t->{t} = $now + $t->{interval} if exists $t->{interval}; } } + + $lasttime = $now; } sub DESTROY