Home AMX User Forum NetLinx Studio

WAIT

I've heard several different ideas of how long WAIT 1 is. Netlinx Studio help says a millisecond - 1/1000th of a second, but other times says 'measured in 1/100th of a second'. I've also seen people on this forum stating that WAIT 11 is 1.1 seconds, so measured in 1/10th of a second!

Discuss & clarify!

Thanks,
Nick

Comments

  • Joe HebertJoe Hebert Posts: 2,159
    WAIT 10 = 1 second
  • ericmedleyericmedley Posts: 4,177
    You can get into the milliseconds by using a timeline. However, it should be noted that this is not a dead-on millisecond measurement. I'd not use a timeline for measuring stuff. For that I'd go to processor ticks. The guys here on the forum have routines they regularly use to accurately time stuff. Me, I'm too right-brained to care about accurate timing. ;)
  • svTechsvTech Posts: 44
    You can also get finer wait times. WAIT 0.1 is a wait of 0.01 secs.
  • ericmedleyericmedley Posts: 4,177
    svTech wrote: »
    You can also get finer wait times. WAIT 0.1 is a wait of 0.01 secs.

    This is a relatively new thing.
  • Joe HebertJoe Hebert Posts: 2,159
    ericmedley wrote: »
    This is a relatively new thing.
    Relativity new is relative but as far as I can remember WAIT .1 (0.01 seconds) has always been legal in Netlinx. At least I think it has.
  • jjamesjjames Posts: 2,908
    Joe Hebert wrote: »
    Relativity new is relative but as far as I can remember WAIT .1 (0.01 seconds) has always been legal in Netlinx. At least I think it has.

    Agreed - I've used this as far back as 2005 (I know - nothing compared to some old-schoolers here.)
  • DHawthorneDHawthorne Posts: 4,584
    I'm about as old-school as they come, and I had no idea you could put a fractional value on a WAIT.

    I bet it came in with Netlinx, I can't imagine Axcent supported it.
  • Joe HebertJoe Hebert Posts: 2,159
    DHawthorne wrote: »
    I'm about as old-school as they come, and I had no idea you could put a fractional value on a WAIT.

    I bet it came in with Netlinx, I can't imagine Axcent supported it.
    That sounds right Dave. I don’t think we had anything less than a WAIT 1 (0.1 seconds) in Axcess.
  • Joe HebertJoe Hebert Posts: 2,159
    As a follow up regarding WAITs in Netlinx:
    NOTE: If greater precision is required, the time parameter can be expressed as a decimal fraction, for example 0.1 to specify a wait time of 1/100th of a second. The range is 0.1 - 0.9.
  • jjamesjjames Posts: 2,908
    DHawthorne wrote: »
    I'm about as old-school as they come, and I had no idea you could put a fractional value on a WAIT.

    I bet it came in with Netlinx, I can't imagine Axcent supported it.
    I should have qualified my post that I've only ever dealt with NetLinx, and have briefly looked at an Axcent program or two.
  • mpullinmpullin Posts: 949
    DEFINE_PROGRAM
    WAIT 10 tp_feedback();
    
    calls tp_feedback() every second.
  • jjamesjjames Posts: 2,908
    mpullin wrote: »
    DEFINE_PROGRAM
    WAIT 10 tp_feedback();
    
    calls tp_feedback() every second.
    *GASP*
    Are you trying to start a debate why not to run feedback in define_program or a timeline? ;)
  • mpullinmpullin Posts: 949
    jjames wrote: »
    *GASP*
    Are you trying to start a debate why not to run feedback in define_program or a timeline? ;)

    I'm just saying.
  • ericmedleyericmedley Posts: 4,177
    DHawthorne wrote: »
    I'm about as old-school as they come, and I had no idea you could put a fractional value on a WAIT.

    I bet it came in with Netlinx, I can't imagine Axcent supported it.

    I'm so old skool they tore the school down Dave.

    In all these years of doing Netlix I didn't know you could go below a 10th of a second. I too am from the old Accent days. I don't use waits that much anyway.
  • ericmedley wrote: »
    I'm so old skool they tore the school down Dave. In all these years of doing Netlix I didn't know you could go below a 10th of a second. I too am from the old Accent days. I don't use waits that much anyway.

    I started programming AXcess in 1997 when I worked at AMX as the AXcess programmer for the Synergy department. It did not support fractional wait values. Wait 15 = approx 1.5 seconds. I believe NetLinx has always supported fractional wait times. Since timeline events are a part of NetLinx and they have an even sharper theoretical resolution, it makes sense that waits can be similarly defined. Wait 15.5 = approx 1.55 seconds. A timeline event with a length of 1550 would also = approx 1.55 seconds.
  • viningvining Posts: 4,368
    So if the the overall wait flag is set, meaning at least one wait is in the queue how often then does the wait queue get checked and the wait time get decremented? I always assumed every 100ms but does this now mean that the queue is checked every 10ms or worse every 1ms instead? Is it adaptive and change depending on the resolution needed? It doesn't seem efficient to check a queue every 1ms or even 10ms (when wait pending) if 99.99999% of defined waits will only need a 100ms resolution especially given the amount of waits that could be active at any given time. That could be a good size for loop running every 10ms, checking and decrementing. I've never used a wait less than 1 although I think I have heard of this decimal stuff before, just never needed a lesser wait time so I never gave this concept any mind.
  • Joe HebertJoe Hebert Posts: 2,159
    Please WAIT...
    vining wrote: »
    So if the the overall wait flag is set, meaning at least one wait is in the queue how often then does the wait queue get checked and the wait time get decremented? I always assumed every 100ms but does this now mean that the queue is checked every 10ms or worse every 1ms instead? Is it adaptive and change depending on the resolution needed? It doesn't seem efficient to check a queue every 1ms or even 10ms (when wait pending) if 99.99999% of defined waits will only need a 100ms resolution especially given the amount of waits that could be active at any given time. That could be a good size for loop running every 10ms, checking and decrementing. I've never used a wait less than 1 although I think I have heard of this decimal stuff before, just never needed a lesser wait time so I never gave this concept any mind.

    WAITs are serviced after each event that is handled and after every pass thru mainline. Here’s a picture from the AMX help file (and TN264) which illustrates that.

    One may or may not need a WAIT of less than 1 but perhaps a WAIT 3.5 might fit better than a WAIT 3 or a WAIT 4 in some situations. It's good to know we have the option.
  • viningvining Posts: 4,368
    I think I'd rather have it checked by an internal wait timeline that starts when a wait is placed in queue and is killed when the last queued wait expires. Then have the timeline run at 100ms unless a decimal value is passed in and then it would then run at 10ms. Either timing rep rate would decrement the wait times by the timeline rep time. Any wait going into queue would turn on the TL if not running and the timeline would turn itself off when all waits are completed. It would automatically shift the rep rate depending on whether a decimal value is present in the queue or not.

    Then the mainline would only have to check the wait TL every pass to see if it active or not and if active process it when its rep time is reached.
  • DHawthorneDHawthorne Posts: 4,584
    Since WAITs are checked in mainline, anything that bogs mainline down can delay the way (not likely more than a few milliseconds on a NetLinx master, unless there is really a lot going on). It's a minimum time, not a precision timer.
  • nhightonnhighton Posts: 18
    Thanks guys, as usual more information than required - I'm sure you wouldn't have it any other way :)
  • Is the timeline helpfile wrong??

    In the time help file
    From the Timed Waits helpfile:
    Time is expressed in 1/10th second units

    WAIT 10 (* wait one second*)

    From the TIMELINE_CREATE helpfile:
    "Time is measured in 1/100 of a second."


    My testing of waits shows that my processor (NI2000) is actually 1/1000 as mentioned in the thread here!

    ie. a time line interval of 1000 is one second
  • jjamesjjames Posts: 2,908
    It's a typo - it's always been measured in thousandths.
  • jjamesjjames Posts: 2,908
    Wait - I'm confused now . . . what do you want? WAIT or TIMELINE?

    wait 10 = one second
    timeline time array of {1000} is one second

    Nothing's changed in the past 7 years of me doing this - can't speak for anything prior to that.
  • papadoukpapadouk Posts: 58
    i've been programming AMX since 2000, and as jjames stated:

    wait 10 = one second
    timeline time array of {1000} is one second

    about time precision in WAITs, i never used it... When i need to deal with 1/100s or 1/1000s i use Timelines
Sign In or Register to comment.