April 13, 2023
by Matt Raines

Lightweight time tracking with gtimelog

Time tracking software with some example entries filled in

Every morning at our full-team stand-up meeting we all share what we accomplished yesterday, what we plan to work on today, and the obstacles getting in our way. I wanted a way of tracking what I’ve been working on that was unobtrusive and didn’t require big changes to the way I like to work or huge amounts of time spent on the task of time tracking itself.

The solution I found is the simplest you could come up with but I think there is awesome skill in producing an application that does everything it needs to and nothing more.

gtimelog

Naturally I tried quite a few options but the one that’s really stuck is a lightweight application for the GNOME desktop environment, gtimelog. Described as having the main goal of “being as unintrusive as possible”, at its core it consists simply of a big text input field into which I type whatever I have just been doing and hit enter. That’s it. When I switch tasks frequently, I just have to enter the same task over and over again to tally total time spent.

How it works

gtimelog records the current timestamp and whatever I typed into one long text file. This format is so simple that even when I’m working away from my main computer or in Windows rather than Ubuntu, it’s only slightly more complicated to write entries by hand, save them in a text file or Google Keep or wherever, and copy and paste them back into the main log file when I get back to my desk.

It’s possible to track non-work time by adding a double star (**) after any entry. I gave this a try but it isn’t really useful for me to keep track of non-work activities so I quickly gave up on this and could easily edit the text file to remove all the detailed ** entries and replace them with completely untracked lines ending with ***.

At the stand-up I can remind myself of tasks and distractions yesterday just by navigating to the previous day. At weekly sprint meetings, adding tasks is also simply a case of editing another text file which is unobtrusive enough to be done in real time without distracting from the meeting.

Categories

Tasks and log entries can both be categorised just by including the category and a colon before the task title. Once a week or month I can generate a useful report tallying total time spent on each task and on each category. I’ve added categories for key projects which also helps with invoicing, for general housekeeping, study, meetings and training, but the key thing is the tool lets you come up with whatever suits you.

That’s the sum total of the tool’s functionality. It does exactly what I need and no more than I need. I’m a real sucker for spending far too long categorising things when given any opportunity so the key thing is gtimelog isn’t a distraction from getting on with my actual job.

Customisations

I did have a couple of minor niggles. My task list got quite long and because the text file wasn’t sorted by category or task I found it difficult to find and remove items I had completed. And I often think I’ve completed a task when I haven’t, and then end up with the same log entry three times in a row which irritates my sense of zen.

But of course another advantage of the application being so simple is that I can edit them with other tools. A couple of cron jobs are all it takes to clean up the files every 10 minutes of the working day.

# Reverse the time tracker log file (so we keep the most recent entry), remove duplicate lines, and reverse it again
*/10 6-18 * * 1-5 tac /home/matt/.local/share/gtimelog/timelog.txt |uniq -f 2 |tac >/tmp/timelog-matt.txt; mv /tmp/timelog-matt.txt /home/matt/.local/share/gtimelog/timelog.txt
# Sort the task list
*/10 6-18 * * 1-5 sort -o /home/matt/.local/share/gtimelog/tasks.txt /home/matt/.local/share/gtimelog/tasks.txt
# Back up the log file daily, just in case
0 19 * * 1-5 cp /home/matt/.local/share/gtimelog/timelog.txt /home/matt/.local/share/gtimelog/timelog.$(date +\%Y-\%m-\%d).bak