I'm just negotiating a freelance job with a company, who want 'day' rate quoted. Being me, I want to define day: usually it'd be 8 hours.
However, I know I cannot program productively for a solid 8 hours.
How many hours do you do, and how do you handle it on such contracts?
If I'm actively engaged with something, like a new algorithm, or the guts of a system, something really compelling and which is 'solvable', i.e., I've got everything nailed down enough that I can fit it into my head and start figuring out what bits are missing, I can achieve flow pretty easily and get maybe a solid 4 hours in that state, with another 4 hours taken up for less productive work getting into and out of that state, and for periodic breaks when I need them.
If it's defining the problem, exploratory coding to try and figure out how to interact with an external system (and that system is documented and sane), probably 3 in flow, with another 3-4 less productive; I'm nearly as productive as when I've got everything I need in my head, but I get drained faster.
If it's drudge work, or just hitting my head against a wall (anything trial and error-y, like interacting with something undocumented, stupid, inconsistent, painful, etc), perhaps 2 somewhat productive hours, over the course of 6 hours (the other 4 aren't productive -at all-), since every single thing will distract me, and after 6 I'm mentally exhausted.