--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/hores.awk Fri Mar 04 11:06:11 2011 +0100
@@ -0,0 +1,37 @@
+#!/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];
+ }
+ }
+}