Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
sjlaube
Visitor

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.
0 Kudos
5 REPLIES 5
NewManLiving
Visitor

Re: wait seems to lose track of time

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
My Channels: 2D API Framework Presentation: https://owner.roku.com/add/2M9LCVC
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
0 Kudos
sjlaube
Visitor

Re: wait seems to lose track of time

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"
0 Kudos
sjlaube
Visitor

Re: wait seems to lose track of time

for anyone else looking, the call is actually

timer.TotalMilliseconds >= polltime
0 Kudos
NewManLiving
Visitor

Re: wait seems to lose track of time

Sorry about that. But it is time for dinner Smiley LOL
Anyway a wait timer can be unreliable
My Channels: 2D API Framework Presentation: https://owner.roku.com/add/2M9LCVC
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
0 Kudos
RokuJoel
Binge Watcher

Re: wait seems to lose track of time

"sjlaube" wrote:
timer.TotalMilliseconds >= polltime


That would be:

if timer.totalMilliseconds() >= polltime


- Joel
0 Kudos