I tried the Pomodoro Technique to avoid distractions and to stay more focused when I started freelancing. I was also trying to track my work time, so I built Tomatoes, a simple web app to do both.
The app is open source, you can download the code at http://github.com/potomak/tomatoes, or you can use the version running at http://tomato.es.