Fix bug: time in range checking return incorrect result

This bug is, if time range is 10:00 PM to 6:00 AM, then from 12:00 AM to 6:00 AM,
time in range checking return false.