If you use teamwork each project will have a log with sign-ins, sign-outs and notes. I don't remember the exact structure of the log (it's a plain text file) but it's probably reasonably easy to set up a database (or maybe an Excel macro) to import and sort the records.
Otherwise you will have to look for some software that tracks computer usage. There used to be some time tracking programs that would do this but I don't know if they're still around. Also, there must be some kind of spyware that you could use to spy on yourself.