one_min_angle = 6
and one_hour_angle = 0.5
(since the hour hand moves 30 degrees per hour and there are 60 minutes in an hour).minutes_angle = one_min_angle * minutes
.hour_angle = (hour % 12 * 30) + (minutes * one_hour_angle)
.diff = abs(hour_angle - minutes_angle)
.diff
and 360 - diff
.