X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FTimer.pm;h=168dd3f5fcb5490fe65e7d636b7ba401d32c34eb;hb=510a9f0644b3a0e02f5951702ada39616bfcfc2f;hp=98132dec6578345a4b955b02af7eae67e5296377;hpb=2b58ccdf81685a1167a43c38705a0d84b9d8d661;p=spider.git diff --git a/perl/Timer.pm b/perl/Timer.pm index 98132dec..168dd3f5 100644 --- a/perl/Timer.pm +++ b/perl/Timer.pm @@ -10,7 +10,7 @@ package Timer; -use vars qw(@timerchain $notimers); +use vars qw(@timerchain $notimers $lasttime); use DXDebug; @timerchain = (); @@ -18,10 +18,12 @@ $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; +$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0)); $main::build += $VERSION; $main::branch += $BRANCH; +$lasttime = 0; + sub new { my ($pkg, $time, $proc, $recur) = @_; @@ -45,7 +47,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 +58,8 @@ sub handler $t->{t} = $now + $t->{interval} if exists $t->{interval}; } } + + $lasttime = $now; } sub DESTROY