Forum Discussion

sjlaube's avatar
sjlaube
Visitor
12 years ago

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.

5 Replies

  • Its probably getting bored - ๐Ÿ˜„
    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 Smiley LOL
    Anyway a wait timer can be unreliable
  • "sjlaube" wrote:
    timer.TotalMilliseconds >= polltime


    That would be:

    if timer.totalMilliseconds() >= polltime


    - Joel