How do I calculate the difference between two times, and subtract 30 minutes if the time exceeds 8 hours?