The java code that polygenlubricants is similar than mine. Let's assume that the clock is 12 hour instead of 24.
If it's 24 hours, then that's a different story. Also, another assumption, assume if the clock is stopped while we calculate this.
One clock cycle is 360 degree.
How many degree can the minute hand run per minute? 360 / 60 = 6 degree per minute.
How many degree can the hour hand run per hour? 360/12 = 30 degree per hour (since hour hand run slower than minute)
Since it's easier to calculate in the unit, "minute", let's get
"how many degree can the hour hand run per minute"?
30 / 60 = 0.5 degree per minute.
So, if you know how to get those numbers, the problem is pretty much done with solution.