How does the client get to know how many hours we worked if I work at my place?
Even if I am ethical, and don't fake my number of hours, how can I help the client believe it?
That's a good question, but I don't think there's any purely logical answer to it. A surprising amount of business is still conducted on the honor system (with each side taking different things on trust). I have freelanced primarily in editing for print publications, and a little bit in design and writing. Some of my clients want an hourly fee, and others want a per-word or project fee. Some who work with hourly fees put a cap on the number of hours I can claim. Sometimes there's an arrangement that if I think I'm going to go over the maximum, I should talk it over with them, and if there's a good reason, they'll usually increase the hours. I'm sure if I spent a ridiculous number of hours on an easy project, a client would just not hire me again. I have never had anyone ask me to prove how many hours I spent on a task. Really, if a client wanted some kind of proof of hours, it would be up to them to ask for it at the start. No matter what payment system you use, somebody is taking a risk. I think it's just one of the ways freelancing is different from staff work. In the long run, both freelancer and client are asking "does this benefit me, and is it worth what I put in?" as long as the answers are "yes," the exact number of hours may not matter.
As guys suggested above, you can use time tracking tools to take snapshot of your desktop and to track time. But even then it will prove that you only worked. For example, a client will look at 8 hours of desktop snapshots without knowing what you did.
So far, the best mechanism I came across is a system of estimation and approval. How does it work? You make a list of features, then you estimate price (or work hours) for each ticket. The client can verify estimation with anyone if he wants. The thing is that you don't start working on a task before the client gave you green light. This way, if he's ready to finance implementation of a feature X which takes Y hours, then you don't have to prove yourself. You can be honest and tell him if it took less time or you can simply charge him estimated work hours. As we all know that some tasks you will finish sooner and some later. In the end, no one is on loss.
One way to prove the number of hours you work - and build trust with your clients - is to use a time tracker. Most kinds of freelancing / small business accounting software such as FreshBooks or QuickBooks (both available in the US) have some support for this built in.
I've also tried some free, standalone time tracker applications such as Chrometa and Toggl. Of those, I found Toggl easier to use because it feels more natural to use it. You can tell Toggl, "I'm doing work for this client now" or "I'm doing this kind of work for this client now" and the clock just runs until you tell it to stop. So it is easier to account for time that you work offline that way. (As a UX designer I spend a good deal of time sketching, so that is not on the computer.) Toggl also sends you an email if you leave the clock running longer than a certain amount of time like 8 hours or 24 hours.
If you use a time tracker and the client doubts that you're actually doing your work during the whole time, use a productivity tracker. Chrometa has some of these capabilities built in because you have to match every webpage you look at to a project. (I found that rather tedious and switched to Toggl.) RescueTime is a productivity tracker with free and premium plans. It only tracks time when you're actually doing something on the computer, not just when the computer is on. It has preset ratings (very distracting, distracting, neutral, productive, and very productive) which it is able to assign for many major websites. You can override the rating for any website. The Pro version shows you how much time you spend in individual documents and gives you a Stay Focused feature to block all very distracting sites for the period of time that you specify.
If you are getting work through freelancing websites (I don't), some of them use screen snapshot software to take screenshots of your computer. Last time I checked, oDesk was doing this and their software took screenshots every 10 minutes to send to the client.
Another way to build that trust along side using a time tracker is to explain to the client everything that you worked on during those hours. As a graphic designer, I list out things like "1.5 hours creating sketches" then attach a small picture of those sketches, "30 mins scanning and editing sketch" "2 hours finalizing outlines of logo" so on and so forth. Keep records of the different stages you are in and make multiple files of your work.
As a developer, I'm not too sure the process you go through but every hour take a screenshot or list out the problems you solved. If the client sees that you are getting work done during the hours they are paying you then you will be able to build up that trust.
There are some web applications (that also have a mobile app) that you can use to help track your time. One I have in mind is called Harvest, they have a free plan and paids one as well (depending on how many clients you handle at a time, the free option may work fine for you). You can break down your time by creating tasks, e.g. Design, Development, Research, and Administrative (time dealing with the client). The purpose of doing this is you can then have Harvest generate an invoice for you and send that to your client. The client can then have a breakdown of exactly what you spent your time on.
But my honest opinion is that if they want to know how much time you spent on each specific task, such as designing "A" and writing copy for "B", and so on, then they have a trust issue. If they don't trust you enough to handle yourself on the specifics and want to micromanage you, then you should look at your situation and see if you need that client. Don't be afraid to fire them, you don't need someone questioning every move you make. You were hired by them, that means you were professional enough for them to decide to (hopefully) pay you for your time and work. You can try talking to them, see what is causing the situation, but sometimes some clients just feel like if they don't have their hands in a project all the time then they aren't doing their job. Those kinds of clients can be a drain on you.