X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?p=spider.git;a=blobdiff_plain;f=perl%2Fcluster.pl;h=d783bff33fa553deb411d410752bca80b51e87ef;hp=8e88884214b0b3b239d003d31f2982cbb7b14265;hb=cce345b95c555a0b45218c5b452bc0f5f4f13bab;hpb=8a0f0fc3c54895f0ce8b0207e42af1f693d757f6 diff --git a/perl/cluster.pl b/perl/cluster.pl index 8e888842..d783bff3 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -48,7 +48,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 { @@ -171,13 +172,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) {