• 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
NSTimer is firing twice...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTimer is firing twice...


  • Subject: NSTimer is firing twice...
  • From: Jonathan del Strother <email@hidden>
  • Date: Thu, 1 Jan 2004 16:12:43 +0000

I have an NSTimer, set to fire once a second:
timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self
selector:@selector(updateFpsCounter) userInfo:nil repeats:true];


The function that it calls updates a counter in my interface:
- (void)updateFpsCounter
{
NSLog(@"Updating FPS");
[fps setStringValue:[NSString stringWithFormat:@"%i fps \n %i tps",
frameCount, tickCount]];
frameCount = 0;
tickCount = 0;
}


However, the timer is firing twice in quick succession. Here's my
output log :
2004-01-01 16:05:16.549 Emergence[2844] Updating FPS
2004-01-01 16:05:16.561 Emergence[2844] Updating FPS
2004-01-01 16:05:17.549 Emergence[2844] Updating FPS
2004-01-01 16:05:17.561 Emergence[2844] Updating FPS
2004-01-01 16:05:18.570 Emergence[2844] Updating FPS
2004-01-01 16:05:18.581 Emergence[2844] Updating FPS

- it seems to be calling the function twice, a few milliseconds apart.

Any ideas what might cause this?

Thanks,
Jon
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: NSTimer is firing twice...
      • From: Jonathan del Strother <email@hidden>
  • Prev by Date: Re: [ANN] Mulle kybernetiK - Optimizing Objective-C code - Articles #3.1 + #9 online
  • Next by Date: Re: I know this isn't really a cocoa prob.... but please help
  • Previous by thread: Re: [ANN] Mulle kybernetiK - Optimizing Objective-C code - Articles #3.1 + #9 online
  • Next by thread: Re: NSTimer is firing twice...
  • Index(es):
    • Date
    • Thread