I finished it in 5 minutes. My boss asked what happened, I told him, and he told me to revert the code, work on other tasks, and redo it at the end of the day so he could bill for 8 hours (in addition to billing for the other tasks I worked on).
I did it and didn’t say anything. This was just a few weeks into my career.
I’m surprised this kind of thing doesn’t happen more often, to be honest. The people handling the business and writing the checks never seem to know anything about software. You could probably get away with telling them just about anything.
I’ve only ever seen it happen once, though. Software industry has been pretty honest in my experience (at least as far as billing goes...)