5 Replies Latest reply on Jun 6, 2008 12:13 PM by Newsgroup_User

system time precision

After quite some time working on a game that requires extreme timing precision, I finally think I've determined why 1 in every (large number) of computers behave differently. I believe it's due to the precision of system.milliseconds for that particular computer.

I have scrolling lyrics that are based on the timing of the lyrics during a song. The timing is based off the start time of the song as the lyrics begin scrolling with start time of song + start time of lyric (basically). The computer that is not working will have lyrics that slowly begin to be off their mark and by the end of the song will be quite a bit off the mark, while the computers that work will always be on their mark.

I finally determined today that on the working computers the full precision of 8 places of _system.milliseconds is being utilized but the computers that do not work properly are only seeing 6 places (0.000000)

Has anyone come across this problem before? How could I determine what the precision is for computer's system clock?
• 1. Re: system time precision
> How could I determine what the precision is for computer's system clock?
If we are talking about windows, besides director's milliseconds command
that returns the result of the API's GetTickCount command, the OS supports a
more precise method of measuring the time - using 'performance counters',
that is.
The accuracy of the method depends on the one of the hardware clock, and, in
all cases, it is sub-millisecond.
To test the alternative, download
http://xtrema.rtr.gr/beta/xtrema.zip
and use the xMsF() command:
put the milliseconds, xMsF()
-- 61294308 61312246.1777
Note that the integer part of the xMsF() is not equal to the result of the
milliseconds.
Case you do the test, i'm interested in your results.

"cratica" <cratica@austin.rr.com> wrote in message
news:g29rqg\$fqb\$1@forums.macromedia.com...
> After quite some time working on a game that requires extreme timing
> precision,
> I finally think I've determined why 1 in every (large number) of computers
> behave differently. I believe it's due to the precision of
> system.milliseconds
> for that particular computer.
>
> I have scrolling lyrics that are based on the timing of the lyrics during
> a
> song. The timing is based off the start time of the song as the lyrics
> begin
> scrolling with start time of song + start time of lyric (basically). The
> computer that is not working will have lyrics that slowly begin to be off
> their
> mark and by the end of the song will be quite a bit off the mark, while
> the
> computers that work will always be on their mark.
>
> I finally determined today that on the working computers the full
> precision of
> 8 places of _system.milliseconds is being utilized but the computers that
> do
> not work properly are only seeing 6 places (0.000000)
>
> Has anyone come across this problem before? How could I determine what
> the
> precision is for computer's system clock?
>
>

• 2. Re: system time precision
Wow, bless you alchemist. That function did the trick. The lyrics are now 100% on time everytime even on the computer that was never on time.

Thank you so much!!!!!

Now, if I could figure out how to keep the xtrema debug window from popping up at runtime, that would be great!! I looked through the documentation and didn't see anything about this debug window and it seems it pops up automatically anytime any function is called. Thoughts?
• 3. Re: system time precision
The (old) docs you read refer to the string object only - the Xtra consists
of about 20 objects that are being documented as we speak.
Though this will be a commercial Xtra, it will contain several free
functions, like the one you used.
There is no way to disable the debugger in beta versions. Since the final
version will not be available anytime soon, not within the week at least,
I'll try to find some time to compile an Xtra for you that will contain just
this command. Mail me using the link at the first page of the site from an
account that can receive attachments and I'll reply with the Xtra attached -
within the day probably.

"cratica" <cratica@austin.rr.com> wrote in message
news:g2aj1j\$979\$1@forums.macromedia.com...
> Wow, bless you alchemist. That function did the trick. The lyrics are
> now
> 100% on time everytime even on the computer that was never on time.
>
> Thank you so much!!!!!
>
> Now, if I could figure out how to keep the xtrema debug window from
> popping up
> at runtime, that would be great!! I looked through the documentation and
> didn't see anything about this debug window and it seems it pops up
> automatically anytime any function is called. Thoughts?
>

• 4. Re: system time precision
Done.

You are very helpful!
• 5. Re: system time precision
Thanks. But I'm having trouble with the mail you sent me - rejecting the
reply, that is. You have any other account available?

"cratica" <cratica@austin.rr.com> wrote in message
news:g2bvl1\$s87\$1@forums.macromedia.com...
> Done.
>
> You are very helpful!