• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cocoa, C++, Keyboard input and Timers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Cocoa, C++, Keyboard input and Timers
      • From: Brian Christensen <email@hidden>
References: 
 >Cocoa, C++, Keyboard input and Timers (From: Josh de Lioncourt <email@hidden>)

  • Prev by Date: Cocoa, C++, Keyboard input and Timers
  • Next by Date: Re: Cocoa, C++, Keyboard input and Timers
  • Previous by thread: Cocoa, C++, Keyboard input and Timers
  • Next by thread: Re: Cocoa, C++, Keyboard input and Timers
  • Index(es):
    • Date
    • Thread