# CONFIG file is inserted here

if [ x"$1" = x'-t' ] ; then
	SORTMODE="+1nr"
else
	SORTMODE=""
fi

grep '^U:' $LIB/Log |

awk '
BEGIN {
	any=0
}
NF == 7 { 
	if (split($7, t, ".") == 2) { 
		u[$5] += t[1] * 60 + t[2]
		any=1
	}
}
END {
	if (!any) {
		printf("No usage statistics\n")
		exit
	}
	for (n in u) {
		name=substr(n, 2, length(n)-3)
		printf("%-10.10s%8d.%02d\n", name, u[n]/60, u[n]%60);
	}
}' |

sort $SORTMODE
