What's a program function? What kind of program are we talking about - is it running all the time, started on demand, ... ? Should the "program function" abort if the clock passes 7AM and it's still running? Or perhaps it should wait till 7PM? Why aren't you just checking the current time?