Re: Cocoa, C++, Keyboard input and Timers
Re: Cocoa, C++, Keyboard input and Timers
- Subject: Re: Cocoa, C++, Keyboard input and Timers
- From: Brian Christensen <email@hidden>
- Date: Mon, 16 Jun 2008 18:43:32 -0400
On Jun 16, 2008, at 5:47 , Josh de Lioncourt wrote:
Next, I need to be able to keep track of real-time during the game.
In Windows, we'd use something like GetTickCount to accomplish
this. Is there an equivalent on the Mac side? Again, pointing me
in the right direction would be tremendously appreciated.
mach_absolute_time() will give you high precision timing. There's a
technote on this subject here: <http://developer.apple.com/qa/qa2004/qa1398.html
>
Alternately, you can retrieve the absolute time using UpTime() (found
in <CarbonCore/DriverServices.h>, which you'd likely need to import
anyway for the conversion routines AbsoluteToNanoseconds() and
AbsoluteToDuration().
(I do not know what the difference is, if any, between using
mach_absolute_time() and UpTime().)
/brian
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden