A Better way?

 

I want something to happen every morning at 16:00 market watch. Using if(Hour() == 16 && Minute == 00 && Seconds = 00) is risky because if you don't get a tick at that second, it will never turn true so I use:

if(Hour() == 16 && Minute == 00 && Seconds = 1 ||2 || 3 ||4)

{

RUN

}

This works but I just feel there must be a better, more "logic oriented" way to go about it, any suggestions?

BB

 

Why not just use:


if (Hour() == 16 && Minute == 00 && !bDoneStuff)

{

... do stuff ...

bDoneStuff = true;

}


CB

Reason: