CACurrentMediaTime rather than CFAbsoluteTimeGetCurrent

Hi all

A regular reader of the blog has sent in some interesting information about CFAbsoluteTimeGetCurrent.

It would appear that Apple recommend using CACurrentMediaTime rather than CFAbsoluteTimeGetCurrent. It would appear that CFAbsoluteTimeGetCurrent uses the network synched time which can cause irregular skips in timing. I’ve changes to CACurrentMediaTime and its working well. I’ve not noticed a huge difference, but the odd larger than usual skips I was getting have gone.

More can be found at the Apple Dev forum here.

Mike

Share:
  • Digg
  • del.icio.us
  • Facebook
  • MySpace
  • Reddit
  • StumbleUpon
  • Technorati
  • TwitThis
  • Design Float
  • DZone
  • email
  • Google Bookmarks
  • LinkedIn
  • Scoopeo
  • Tumblr

6 Comments

Anonymous  on September 5th, 2009

I changed CFAbsoluteTimeGetCurrent to CACurrentMediaTime in the mainGameLoop method, and now my game isn’t updating at all. Is there something else I need to change?

Anonymous  on September 6th, 2009

shiiiiiiiiiiiiiit

Mike1o1  on September 6th, 2009

Anonymous,

Make sure that the the initWithFrame section of EAGLView.m is also changed to CACurrentMediaTime. Otherwise your first delta will be messed up!

Hope that helps, as I had a similar issue when I only changed it in the main game loop.

Regards,
Mike

Anonymous  on September 6th, 2009

Thanks so much, that worked. I was looking for something like that but couldn’t find it.

Tip: CACurrentMediaTime at Under The Bridge  on September 6th, 2009

[...] h/t: 71^2! [...]

A Person  on September 20th, 2009

@mike

Hey mike i have now switched back to my old objective-c engine for various reasons and have just been updating and finishing it off. I am almost done but i have one problem whenever i draw an Image there is a triangle cut out on the left hand side. This is not related to Image class because if i use your image class it still does the same thing. It seems as if the EAGLView could have something to do with it, any ideas.

Leave a Comment