However, creative stuff like programming doesn't tend to fix in such a neat box, and the preparation, or creative thinking which leads to elegant solutions to problems tends to benefit from spending time doing something else - your brain is still whirring on the problem whilst you are out walking, exercising, cooking etc.
If you add on the time spent working through problems, you'll probably come to the same conclusion that I have that I spend 24 hours a day thinking about the problems i'm tackling. I often come up with great solutions whilst i'm asleep, and bad nights sleep is often correlated with a gnarly problem i've still not worked out.
I personally don't get hung up on how much time I spend actually coding. Some days it's full on, other days I seem to achieve next to nothing, or if anything go backwards. I've never tried to average it out, but 2-4 hours of actual productive coding per day sounds about right.