Keeping Track of Hours Spent on Projects, the Easy Way

Posted by james on Oct. 22, 2009

Since I work best this way, I tend to work on a few projects during my typical day. I'll work on a project for a few hours until I get tired of it, then switch gears and work on something else. I got this advice from a previous teacher, and it works well for me. The problem is that you can get bogged down working on something and lose momentum. If you switch to something else, you tend to be able to focus better since it's something new. Then you come back to your original project, and those complicated things seem so much more easy, and you might even see something you were missing before.

However, this makes it really hard to keep track of hours spent. I've tried writing down my start & stop times, but it's just so hard to remember to do that when you switch tasks, especially since you're probably wrapped up in some problem at the time. I've also tried making a simple screenshot script that takes screenshots every X minutes, and then I can look back at a visual log of my day. However, that's really annoying to comb through.

I just completed a simple script that does just what I need, and it seems to be working well. Instead of taking screenshots, I have a script that scans a folder and records any modified files since the last time it ran. I have it running every 10 minutes, and it spits out a CSV log of modified files. I then have a web app that takes this CSV file and graphs it for any given day.

This gives me a very pretty and incredibly useful graph of my work on that project during the day.



I can easily see at a glance when I worked, and also when I took breaks. The best thing about this is that it works retroactively, so I don't have to remember to write anything down first, there's nothing to forget. At the end of the day I just look at my log and I can tell exactly how much I've worked.

Some details: the scanning script is in python, run at the lowest process priority. It creates a separate mod log for each give folder (to track different projects). The web app is written in django, and it loads the CSV log file, scans for each day, then graphs the results with the awesome and simple Google Graph API. That's it.

I think this might be nice to package into an installable program. I might do this if there's enough demand. At any rate, this satisfies my need and it's really nice to have this working. There have been enough times where I've had to try to figure out when I worked during the week, only to have to estimate after the fact. I tend to estimate on the low side so that I'm not taking advantage of anyone, but that means I'm losing hours. Now I'll make sure to get accurate counts, even if I'm filling out my timecard days later. Awesome.