TimeWait then Time Sleep for Awhile
Keywords: timewait sleep
Question:
I'm wish to launch a piece of code at 8am every day, which I'm doing now with timewait successfully.The part I can't get is another gosub which will check to see if the time is 2:00 PM and go to sleep util 8:00am again. I've tried making a varible tt=00:00:00:09 but the varible can't be converted correctly for a comparision. I also tried strReplace to get out the : and just compare straight numbers, no good as well.
The scope is to run between 8am and 2pm and sleep the rest.
Any ideas?
Answer:
Tricky task. First of all the initialization part of the code has to determine what time it is to decide if it should shart running or start waiting.Once you decide to wait for 8AM it is easy, its just a TimeWait.
But when you are running, you have to check to see 2PM roll around.
So I would.....
Right after the TimeWait("0000:00:00:08:00:00"), add
eightam=TimeYmdHms()which will capture the 8 AM time TODAY into a variable.then in your loop someplace...
now=TimeYmdHms() diff=TimeDiffSecs(now,eightam) if diff > 8*3600 then time to wait some more
Article ID: W13894Filename: TimeWait then Time Sleep for Awhile.txt