#!/s/std/bin/perl
while ($topdir = <*/condor-admin>) {
print "topdir is $topdir\n";
	if (-d $topdir) {
		while ($file = <$topdir/[0-9]*>) {
			if (-f $file) {
				print "$file\n";
				$ticket = $file;
				$ticket =~ s/^[^0-9]+//;
				$ticket += 0;

				$borndate = 0;
				open (THERUST, "$file");
				while(<THERUST>) {
					if (/creation/ && $borndate == 0) {
						$borndate = $_;
						$borndate =~ s/^[^(]+\(([0-9]+).+$/\1/;
						$borndate += 0;
						print "$borndate is borndate\n";
					}
				}
				$rust{sprintf("%4.4d",$ticket)} = $borndate;
			}
		}
	}
}

foreach $ticket (sort keys %rust) {
	$fred = localtime($rust{$ticket});
	print "$ticket\t",$rust{$ticket},"\t$fred\n";
}
$i = 100;
open (FOO, ">/tmp/foo.$$");
while ($i < 2100) {
	$old = $i - 100;
	if ($old < 1) {$old = 1;}
	while(!defined( $rust{sprintf("%4.4d",$old)} )) {
		$old--;
	}
	$new = $i;
	while(!defined( $rust{sprintf("%4.4d",$new)} )) {
		$new--;
	}
	$oldticket = $rust{sprintf("%4.4d",$old)};
	$ticket = $rust{sprintf("%4.4d",$new)};

	print "$old to $new\t",($ticket-$oldticket)/60/60/24,"\n";
	print FOO "$old to $new\t",($ticket-$oldticket)/60/60/24,"\n";

	$i += 100;
}
close(FOO);
print "\n";
