Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Milliseconds





Laurence Harris wrote:

On Jan 14, 2007, at 6:14 PM, Daniel Shiffman wrote:

Hello!

New to this list.  I'm in the process of porting several PC
application to Mac (Carbon / C++ / OpenGL).  The one last piece I
can't seem to solve is how to retrieve the milliseconds() from the
system clock.  I have an animation that needs to enforce a certain
framerate.  I'm using usleep() to wait between frames, but I need the
milliseconds to determine how long to wait!

Any help would be greatly appreciated.

FWIW, this isn't how Carbon applications generally control animation. They use Carbon event timers set to fire at specific intervals instead.
If you want a consistent framerate, relying solely on Carbon event timers isn't recommended. They might drift or miss a firing interval. If consistency is important, you could use a high-frequency Carbon event timer coupled with the Microseconds call to check the actual elapsed time. (e.g. fire the timer 120 times a second, animate at 30fps.)

If consistency isn't very important, Carbon event timers are probably good enough. They aren't perfect but they do OK.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden


This email sent to email@hidden
References: 
 >Milliseconds (From: "Daniel Shiffman" <email@hidden>)
 >Re: Milliseconds (From: Laurence Harris <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.