X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=perl%2Fcluster.pl;h=666f4f87fd0b59d0b167b297f3ef11cbec3d454c;hb=b473fa8950fc9a6b747be44434569dec254b0897;hp=8e88884214b0b3b239d003d31f2982cbb7b14265;hpb=b060a0a3ee72530aa3f10d453186a662b66d7efe;p=spider.git diff --git a/perl/cluster.pl b/perl/cluster.pl index 8e888842..666f4f87 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -27,6 +27,7 @@ use Msg; use DXVars; use DXDebug; use DXLog; +use DXLogPrint; use DXUtil; use DXChannel; use DXUser; @@ -48,7 +49,8 @@ package main; @inqueue = (); # the main input queue, an array of hashes $systime = 0; # the time now (in seconds) $version = 1.5; # the version no of the software - +$starttime = 0; # the starting time of the cluster + # handle disconnections sub disconnect { @@ -148,7 +150,7 @@ sub process_inqueue my $data = $self->{data}; my $dxchan = $self->{dxchan}; - my ($sort, $call, $line) = $data =~ /^(\w)(\w+)\|(.*)$/; + my ($sort, $call, $line) = $data =~ /^(\w)(\S+)\|(.*)$/; # do the really sexy console interface bit! (Who is going to do the TK interface then?) dbg('chan', "<- $sort $call $line\n"); @@ -171,13 +173,23 @@ sub process_inqueue } } +sub uptime +{ + my $t = $systime - $starttime; + my $days = int $t / 86400; + $t -= $days * 86400; + my $hours = int $t / 3600; + $t -= $hours * 3600; + my $mins = int $t / 60; + return sprintf "%d %02d:%02d", $days, $hours, $mins; +} ############################################################# # # The start of the main line of code # ############################################################# -$systime = time; +$starttime = $systime = time; # open the debug file, set various FHs to be unbuffered foreach (@debug) {