46 if ((
self = [super init]))
50 now = [UNIVERSE getTime];
72 return [
self initWithNextTime:[UNIVERSE getTime] + delay interval:-1.0];
86 NSString *intervalDesc =
nil;
88 if (
_interval <= 0.0) intervalDesc =
@"one-shot";
89 else intervalDesc = [NSString stringWithFormat:@"interval: %g", _interval];
91 return [NSString stringWithFormat:@"nextTime: %g, %@, %srunning", _nextTime, intervalDesc, _isScheduled ? "" : "not "];
142 [sDeferredTimers addObject:self];
171 now = [UNIVERSE getTime];
203 NSArray *timers =
nil;
204 NSEnumerator *timerEnum =
nil;
209 for (timerEnum = [timers objectEnumerator]; (timer = [timerEnum nextObject]); )
221 now = [UNIVERSE getTime];
228 scaled = ceil(scaled);
240- (NSComparisonResult) compareByNextFireTime:(
OOScriptTimer *)other
248 @catch (NSException *exception)
250 OOLog(
kOOLogException,
@"\n\n***** Ignoring Timer Exception: %@ : %@ *****\n\n",[exception name], [exception reason]);
253 if (
_nextTime < otherTime)
return NSOrderedAscending;
254 else if (
_nextTime > otherTime)
return NSOrderedDescending;
255 else return NSOrderedSame;