Some time ago I used gtimelog to keep track of my working time. I added an entry when I arrived in the morning and an entry when I left work in the evening. But quite often I forgot to add an entry and after a while I stopped keeping track of how much I worked.

Tracking login and logout times could be confusing, but normally I turn my work station off when I'm leaving work. So if I keep track of it's uptime during a week I (almost) have my working hours. Fortunately Linux already keeps track of this with the wtmp file. So I just have to parse this and presto my working hours for the last week

makholm@makholm:~$ worktime "00:00 a week ago" "00:00 today"
Fri Dec  5 08:19 - worked 07:36
Mon Dec  8 07:05 - worked 09:03
Tue Dec  9 09:10 - worked 00:01
Tue Dec  9 09:11 - worked 08:40
Wed Dec 10 07:33 - worked 08:33
Thu Dec 11 07:04 - worked 02:51
Thu Dec 11 10:43 - worked 06:12
             total worked 43:00

A simple cron script called monday morning should provide me with a weekly mail reporting how much I've worked the week before. The worktime script is quite simple and uses Sys::Utmp to parse wtmp.

Update: improved version