I used RescueTime when I was freelancing. It's an app you install and it tracks what you're working on down to the second. It works by reading the titlebar of your current app, so it works well for development, and you can set up filters in the web dashboard to divide by projects and so on. Of course there's a privacy trade-off to consider as it's a SaaS.