On Linux, Dansguardian can do this, if I remember correctly.
On either platform, the best solution [ self-discipline and willpower failing --- they really shouldn't ;) ] is probably to create a username-work account. On Linux, you can use PAM to enforce login times, so the work account is the only one available 9-5, and the other is the only one available evenings/weekends.
Once you have that, then there is a choice to make. Choose one of:
specifically allow that account to run work-related programs, or deny it from running non-work programs. You can do this using groups and file permissions and such on linux, or SELinux. Or, on Windows, you can do it with active directory and group policy.
Just delete the icons etc. for programs that account shouldn't run as a "soft" limit or discouragement rather than implementing full security.
A combination of both of these.