6 minutes
You can get this by setting up the equation:
x/8 + x/24 = 1
Where x is equal to the amount of hours spent working. In this equation x/8 would be the first. In 8 hours he would paint on room. x/24 would be the second. When you add them together using common denominators, you can find x.