#!/afs/athena/contrib/perl/perl

$nowtime = time;
$host = `hostname`;
chop($host);
open(LOG, "/tmp/activitylog");
open(USE, ">>/mit/$ENV{'USER'}/Other/usage");
$ftime = (<LOG>);
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($nowtime-$ftime);
$mtot = $hour*60 +$min;
print(USE "$host,$mtot,");

while(<LOG>){

if(/ /){
		split;
               	$TT{$_[1]} += int($_[0]);
                $ttm += int($_[0]);

}
}
while(($acti, $utime)= each %TT){
	($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($utime);
	$atot = $hour*60 + $min;
	print(USE "$atot$acti,");
}
print(USE "\n");
close(USE);
