No announcement yet.

Timer Statement

  • Filter
  • Time
  • Show
Clear All
new posts

  • Timer Statement

    When using the Timer statement you have 3 options ON|OFF|STOP

    Does anyone know of a way to check which of these 3 modes the
    current state of the timer is in.

    I'm looking for something on the order of pbv internal variable
    (although none was listed in the help) or maby a Peek function.


  • #2
    We've put a query into R&D to find out if there is some way to poll the timer state.

    However, I'm never heard of any method to find this information out from the RTL, so my guess is that you'll probably have to track it yourself with a [SHARED or PUBLIC?] variable to indicate the state as you alter it.

    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    mailto:[email protected]


    • #3
      Lance ..

      Using a PUBLIC variable is exactly how I've done this for years Lance.

      BTW, your idea of assigning a PUBLIC variable to this is also very
      useful in many other areas as well. This is exactly how I feather in
      the Btrieve error locations in my code to give them 'faked' 'line numbers'
      so that the code can handle the error location analysis and return
      decisions in the same manner as if true line numbers had been present
      and the PB code had been involved.

      It's also exactly the same way I've had to fudge to make phantom 'line
      numbers' for non-numeric line lables. That's the game I wish I could
      throw away in the next incantation of PB for DOS, though.

      It has one other advantage if you learn to do this well with error
      trap work. If you translate PB source code to C/C++ you suddenly have
      the same logic pointers to what I've had to see vanish anyway; our
      dearly beloved numeric line lables! I get the same look and feel
      I've become accustomed to in PB in C/C++ this way.

      It also works very well for non-error, but just help file selection for
      tracing program logic for help display shifting as the program moves
      through the desired logic.

      And .. as your program grows, it's also possible to write a utility
      program that analyzes your source. Provided you have put the part of
      the code like error trapping down near the end of the module, you can
      write a tool which makes a pass to determine at which actual line
      in the program each one of these pseudo 'line numbers' is at. You
      then pair each number with whatever unique trace conditional "IF"
      statement was done to handle a specific pseudo 'line number'. You
      then make a separate pass back through the source and replace the
      trace locations with the actual line numbers for your current as-done
      source. Presto! A way to keeep all that nice numeric digit space
      inbetween these assigned numbers, in case you want to use a new spot
      for what was left out needed to be serviced in the code.

      All of which leads, as well, to the logic required to create a utility
      for re-numbering line lables that really are numeric line lables in
      PB source code..

      All with long integers of course.. And as long as this all doesn't get
      bigger than 65535 lines of source -

      GDRFC ...

      Mike Luther
      [email protected]
      Mike Luther
      [email protected]