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

  • Home
  • SEARCH
  • 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 185767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:31:44+00:00 2026-05-11T15:31:44+00:00

I need to run my game loop with very accurate timing. I am trying

  • 0

I need to run my game loop with very accurate timing. I am trying to use NSTimer to do this, and I am getting ok results, but there is a bit of drift. When NSTimer fires does the next time event start counting when the handler finishes or does it start counting straight away. If the former is it reasonable for me to use setFireDate to try to offset the next timer firing – when I tried this things seemed worse.

My timer is set to fire every 44ms and I would like to stop it drifting by more than 20ms. If it does drift I would like to correct it for the next fire. Is this a reasonable thing to try and do with NSTimer?

  • 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. 2026-05-11T15:31:45+00:00Added an answer on May 11, 2026 at 3:31 pm

    You might try creating a thread and scheduling your timer on that thread’s run loop. Having that timer as the only thing on that run loop should limit the number of things that can interfere with it.

    If that doesn’t work, well, you’ll already have it working on a thread, so you may as well switch to a usleep() loop.

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

Sidebar

Related Questions

I need to run an application in an embedded system continuously. While implementing this
So, I need to build a kiosk type of application for use in an
I need to run an .sh file and get its output. I need to
I need to run the following command in a folder containing a lot of
I am talking about a small game engine using C# for game programming. So,
I've already written a game engine in java using eclipse and opengl es, I
I'm doing an inventory for a game, rather like a FF-style game. I have
I've read several example programs and tutorials to try and solve my problem but
I am trying to invoke external program (in my case IECapt.exe) in php function
I am teaching myself some Python and I have come across a problem which

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.