Re: Synchronize timer with internal clock
Re: Synchronize timer with internal clock
- Subject: Re: Synchronize timer with internal clock
- From: Chris Kane <email@hidden>
- Date: Sun, 16 Mar 2003 12:29:09 -0800
This sounds like the run loop is not being run, or you're not adding
that timer you're creating below to the run loop. (John C. Randolph
<email@hidden> in his previous response left that step out as well
from his email -- probably figured you would get the rest OK.)
Also, dateByAdding... is a big 200hp engine, when you only need
something much smaller: round the current NSTimeInterval to the next
multiple of 60.0: floor(ti/60.0)*60.0 + 60.0 and create an NSDate with
that NSTimeInterval.
Chris Kane
Cocoa Frameworks, Apple
On Friday, March 14, 2003, at 16:02, Frank Fenn wrote:
Hi all,
I've tried the following code:
NSCalendarDate *now = [NSCalendarDate calendarDate];
NSCalendarDate *run = [now dateByAddingYears:0 months:0 days:0
hours:0 minutes:1 seconds:(60-[now secondOfMinute])];
timer = [[NSTimer alloc] initWithFireDate:run
interval:60
target:self
selector:@selector(timerAction:)
userInfo:nil
repeats:YES];
This is not working for me (10.2.4) - a NSLog of "run" before and
[timer fireDate] after the timer is initialized shows
the right date/time. [timer isValid] returns 1. The timerAction is
never executed. A manual [timer fire] works.
Any ideas?
--
regards
Frank Fenn - Bright Light Software
_______________________________________________
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.
_______________________________________________
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.