
You should perhaps be doing this a cron job on your operating system. Have one cron to start the task at a particular time and second one to terminate it at the required end time . Ashok On 2 May 2013 09:54, Bwana Lawi <mail2lawi@gmail.com> wrote:
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
_______________________________________________ skunkworks mailing list skunkworks@lists.my.co.ke ------------ List info, subscribe/unsubscribe http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------
Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke