1 Reply Latest reply on Jul 15, 2008 11:31 AM by Newsgroup_User

    system time and timing

    ekochman
      Hi,
      I have a lingo script that listens for events occurring through a third party Xtra. I want to record when those events occur so that I can replay the sequence of events. For example, when the user clicks a start recording button, I'll call that time 0. Every event recorded after that should get indexed from that point. However, _system.time(), as far as I can tell, returns a String, so there's no way to be sure that the arithmetic will work and not return an error. Is there another way to get the system time as a number so that I can count on the computation working?

      on startRecording()
      set startTime to _system.time()
      end

      on eventOccurred()
      ...
      set eventTime to _system.time() - startTime
      ...
      end

      Thanks
        • 1. Re: system time and timing
          Level 7
          You can use 'the milliseconds' to time things. At the start (your time
          0 scenario), find out what the milliseconds is. Then subtract the
          current milliseconds from that to find out when each action happened


          global gTimeCount

          on startRecording
          gTimeCount=the milliseconds
          end

          on eventOccurred
          eventTime=the milliseconds-gTimeCount
          --store this value somewhere
          end

          Just remember to multiply by 1000 to get the value in seconds if you
          need it.