Checking the Milliseconds

Sean Cole (Pi) sean at pidigital.co.uk
Wed Apr 7 19:24:30 EDT 2021


Hi Tom

It is really interesting to see the results from this though. Tried it on
my various machines and got pretty much the same results as everyone else
consistently. It's amazing to see that in the region of 3000 loops occur in
the period of 1ms. which means we are perhaps getting 1 (lowish level) line
every 0.0001ms. Obviously heftier calls will take longer but it's a good
indicator.

Here's a good check of accuracy (sorry for the formatting):

local sMS

on mouseUp
   put the long millisec into sMS
   send "checkTime" to me in 1 sec
end mouseUp

on checkTime
   put the long millisec - sMS
end checkTime

// The long milliseconds gives you even more detail on the amount of time
elapsed. The variance is quite something.

Sean

On Wed, 7 Apr 2021 at 23:14, Tom Glod via use-livecode <
use-livecode at lists.runrev.com> wrote:

> Excellent ... Yes the 1st one was usually the one that was the lowest for
> me, for the reason you described.
> But you also cleared up the mysterious big jumps,I too now get a consistent
> result.
> Thanks for chimming in
>
>
> On Wed, Apr 7, 2021 at 3:59 PM Niggemann, Bernd via use-livecode <
> use-livecode at lists.runrev.com> wrote:
>
> > 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
> >    repeat
> >       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
> >          else
> >             exit repeat
> >          end if
> >       end repeat
> >       put queries && (the long seconds - longSecs) * 1000  & cr after
> > report
> >    end repeat
> >
> >    unlock screen
> >    put report
> > end mouseUp
> > --------------------------
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
>
>
> --
> Tom Glod
> Founder & Developer
> MakeShyft R.D.A (www.makeshyft.com)
> Mobile:647.562.9411
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list