I charge by time, even though I am producing results. The biggest advantage is that it deals with changes in the specs, addition or removal of features, new environmental issues (eg also test on ARM, use a cluster).
If you charge for results only, then any change in what is desired means a renegotiation. Attaching a dollar figure to every "could you also ..." gets old quickly.
For your regular employer what you are after is ROWE - results only work environment - https://en.wikipedia.org/wiki/ROWE