Checking the Milliseconds

Niggemann, Bernd Bernd.Niggemann at
Wed Apr 7 15:57:44 EDT 2021

I tried this and got pretty constant results except for maybe  the first ten iterations. I figured if you just jump in with the milliseconds you would not be at the "beginning" of the milliseconds and added a repeat loop to mitigate that effect. Furthermore I appended the result to a variable.

local last_known_millisecond
local queries = 0
local report
local longSecs, tMs

on mouseUp
   lock screen
   put empty into report
   --let it start at a flip of the ms
      put the milliseconds into tMs
      if char -1 of tMs is 0 then
         exit repeat
      end if
   end repeat
   repeat 1000 times
      put 0 into queries
      put the long seconds into longSecs
      put the milliseconds into last_known_millisecond
      repeat forever
         add 1 to queries
         if the milliseconds = last_known_millisecond  then
            next repeat
            exit repeat
         end if
      end repeat
      put queries && (the long seconds - longSecs) * 1000  & cr after report
   end repeat
   unlock screen
   put report
end mouseUp

More information about the use-livecode mailing list