Re: syncing NSTimer with system clock...
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.