#!/home/llbatlle/.nix-profile/bin/awk -f
#
# Entrada: tt -t
#
# Distingeix 'fora' i 'dinar' com a coses que no són de la feina
BEGIN {
fora="fora";
ignora="dinar";
FS=" "
}
{
daystring = substr($3, 2);
work = $2;
if (work == fora)
{
hores = int(accumtime / 3600);
minuts = int((accumtime - hores*3600) / 60);
segons = int(accumtime - hores*3600 - minuts*60);
plegant = substr($4, 1, length($4)-1);
printf "%s: %02i:%02i:%02i (plegant a les %s)\n",
daystring, hores, minuts, segons, plegant;
accumtime = 0;
}
else
{
if (work != ignora)
{
split($1, time, ":");
accumtime += time[1]*3600 + time[2]*60 + time[3];
}
}
}