wait seems to lose track of time

I have a command in my file which looks like

wait(18000,port)

At first it waits the full 18 seconds before continuing, but over time the wait time gets shorter, after an hour or so it is down to only waiting 8 seconds and after a day or two it is not waiting at all. If I restart my app then all is back to normal. I check and there is no activity on the port.

Its probably getting bored - :grinning_face_with_smiling_eyes:
However, you cannot get an exact timer that way, any activity on the port will release wait

may want to try getmessage and a timer:

timer = createobject('rotimespan")

msg = port.GetMessage()

if msg <> invalid then do something

if timer.GetMilliSeconds() >= 18000
do something and start over
timer.mark()
end if

Thanks so much, although I am pretty positive there is no activity on the port, since it degrades over time. But in any case I have implemented a timer like you suggest to guarantee the right amount of “wait time”

for anyone else looking, the call is actually

timer.TotalMilliseconds >= polltime

Sorry about that. But it is time for dinner :laughing:
Anyway a wait timer can be unreliable

“sjlaube” wrote:
timer.TotalMilliseconds >= polltime

That would be:

if timer.totalMilliseconds() >= polltime
  • Joel