Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8352563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:59:47+00:00 2026-06-09T08:59:47+00:00

For my game loop and certain animations I want to know the time interval

  • 0

For my game loop and certain animations I want to know the time interval that has passed since the last call of my render: method.

For this I use the CADisplayLink and grab the current timestamp and subtract the timestamp of the last call. This should give me the correct time interval between two frames/calls.

When running the app in the simulator, I get all sorts of different values for the interval, which seem fine. If I run the app on the iPad however, I only get two different values for the interval: 0.000 and 0.125. Most of the time these two values alternate.

Here is the code I use to determine the interval.

// Time calculations (for animations and stuff)
_lastCallTime = _currentCallTime;
_currentCallTime = [displayLink timestamp];
float timeInterval = _currentCallTime - _lastCallTime;

NSLog(@"Time since last call: %f", timeInterval);

This code gets executed every time the render method gets called.

Is this some restriction of the iPad, that it won’t give me accurate results for my interval?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T08:59:49+00:00Added an answer on June 9, 2026 at 8:59 am

    The timestamp is a double. Change any variable that saves or uses it as a float to NSTimeInterval. When you print it use %f (which is really %lf as C promotes floats to doubles when passed as parameters).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a loop that checks to see if a user's daily game has
Most of us know that a loop should not have a non-terminating condition. For
My question is about game loop design in opengl. I believe that game loop
I currently have a game loop that fires off about 20 times per second
I'm creating a mobile game that that has two parts. The first is slow,
i created a game that has 96 still movieclips and seven more movieclips that
I've cobbled together a simple game loop, mostly using the techniques that seem be
Since i'm writing a game in RoR, i need to have a game loop
What is the best way to code a game loop in Allegro 5 that
I want to start my for loop at a certain number, and make it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.