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 9156427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:46:28+00:00 2026-06-17T12:46:28+00:00

recordingTimer = [NSTimer scheduledTimerWithTimeInterval:0.03 target:self selector:@selector(recordingTimerSelector:) userInfo:nil repeats:YES]; This needs to be very accurate.

  • 0
        recordingTimer = [NSTimer scheduledTimerWithTimeInterval:0.03
                                                          target:self
                                                        selector:@selector(recordingTimerSelector:)
                                                        userInfo:nil
                                                         repeats:YES];

This needs to be very accurate. I’ve been experimenting with it, and it seems to skip a beat every now and again. Is there a better way to run a method every 0.03 seconds?

  • 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-17T12:46:29+00:00Added an answer on June 17, 2026 at 12:46 pm

    NSTimer has a resolution of 50 to 100 milliseconds, or 0.05 to 0.1 seconds. You could try CADisplayLink.

    CADisplayLink* link = [CADisplayLink displayLinkWithTarget:self selector:@selector(doSomething)];
            link.frameInterval = 2;//thirty times a second
            [link addToRunLoop:[NSRunLoop mainRunLoop]
                             forMode:NSDefaultRunLoopMode];
    

    That would call your method thirty times a second.


    EDIT: I searched around for CADisplayLink’s resolution but couldn’t find much, so I did some testing myself.

    I modified some existing code that logs the frame rate using mach_absolute_time() to print the interval in milliseconds between calls to a method I had set up to be called by a CADisplayLink. I did a test on a few hundred time intervals between calls for both CADisplayLink and NSTimer. CADisplayLink had an average deviance (from the target time) of three tenths of a millisecond while NSTimer had an average deviation of half of a millisecond. That’s a decent difference in accuracy considering only a few sprites were rendering to the screen. CADisplayLink was 40% more accurate.

    So, my conclusion is that if you want a method to be called 60/n (where n is a whole integer) times per second, CADisplayLink is vastly superior. You could try running on a different thread as well, where less is going on. That might increase the accuracy of the calls as well.

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

Sidebar

Related Questions

Here is my code: float timeInterval = 1 / [frameRateTextField floatValue]; recordingTimer = [NSTimer
I have a timer function I got off this site and have tried to
I created the SQLite database the following way: private static final String DATABASE_CREATE =
I created an application which stores values into the database and retrieves the stored
I am developing an application for video recording and I want to overlay the

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.