Hi guys,

Programmers, what algorithm would you use to check that a given time (current timestamp in 24hr) is within a preset start and end times and if so, do specific stuff?

Scenario:
 
StartTime = 0600
EndTime = 1800

TimeNow = 0950

An algorithm like 

If TimeNow >= StartTime and <= EndTime then allow

would work

However, this will not work if the Start/End time spans across 2 days:

StartTime = 1800
EndTime = 0600

TimeNow = 0550

Using the logic will fail yet 0550 is logically within the preset timeframe