1 Reply Latest reply on Mar 13, 2008 6:11 AM by Newsgroup_User

    timer trouble

    Xposure Interactive Level 1
      I want to track the total time a user spends in my application. I have the following code when the user has logged on:

      on exitFrame me
      startTimer
      go to movie "xxxxxxx"
      end

      When they exit:

      theSeconds = (the timer / 60)
      theMinutes = (theSeconds / 60)
      gTT = gTT + theMinutes

      gTT is stored and retrieved from a database.

      On some PCs there is no time taken at all and on some PCs the time stored is inaccurate.
      Any help would be greatly appreciated.
        • 1. Re: timer trouble
          Level 7
          I have never had very good luck using startTimer. Instead, you can use
          'the milliseconds' to see how long the program is running:

          global gMS
          on exitFrame me
          gMS=the milliseconds
          go to move "xxxxx"
          end

          and when they exit:

          global gMS

          theMs=the milliseconds-gMS
          theSeconds=theMS/1000.0
          theMinutes=theSeconds/60.0
          gTT=gTT+theMinutes

          putting the '.0' at the end of the divisors forces the result to be a
          float instead of an integer which will be a little more precise without
          the rounding errors inherent in integer math.