• 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
Re: syncing NSTimer with system clock...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: syncing NSTimer with system clock...


  • Subject: Re: syncing NSTimer with system clock...
  • From: Andreas Mayer <email@hidden>
  • Date: Wed, 22 Jan 2003 06:20:24 +0100

Am Mittwoch, 22.01.03 um 05:14 Uhr schrieb Daniel Hedrick:

The menubar clock, and in fact the Clock.app, appeared to be about a half-second behind my timer. However, they were both in lockstep harmony. Any ideas?

I'm not really sure this is the cause for your problem, but ...

now = [NSCalendarDate dateWithYear: [now yearOfCommonEra]
month: [now monthOfYear]
day: [now dayOfMonth]
hour: [now hourOfDay]
minute: [now minuteOfHour]
second: [now secondOfMinute]
timeZone: [now timeZone]];

NSTimer* timer = [[NSTimer alloc] initWithFireDate: now
interval: 1.0
target: self
selector: @selector(changeTime:)
userInfo: nil
repeats: YES];

... it seems unlikely that the timer will be able to fire at a point in time that has actually already passed when it is created. :}

You might want to try

second: [now secondOfMinute]+1

instead.


bye. Andreas.
_______________________________________________
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.

References: 
 >syncing NSTimer with system clock... (From: Daniel Hedrick <email@hidden>)

  • Prev by Date: Re: How to exec a subtool as root
  • Next by Date: Re: Toolbar woes...
  • Previous by thread: syncing NSTimer with system clock...
  • Next by thread: Problem with validateMenuItem and a Modal Dialog, maybe a bug in Cocoa...
  • Index(es):
    • Date
    • Thread