Timer
class provide, in conjunction with the
RunLoop
, event scheduling functionality. Timer
objects can fire
once or repeatedly.
Because the trigger time of a Timer
can change, in case of repeated
firing, a Timer
is not a tom.Date
: a Timer
represents a moment in
time like a tom.Date
, but a tom.Date
is assumed to be constant.
instance (id) withInterval double secs invocation tom.Invocation invocation repeats: boolean repeats_p = NO pre secs > 0.0 || !repeats_p && !secs;
public double fire_time;
public double period;
tom.Invocation invocation;
id (self) initWithFireTime double d invocation tom.Invocation i period: double p = 0.0 pre p >= 0.0;
d
lies in the past, the timer
will fire as soon as possible.
void fire;
tom.OutputStream (s) writeFields tom.OutputStream s;
void cancel pre [self scheduled];
RunLoop
. It must be scheduled
with that RunLoop
.
void schedule pre ![self scheduled];
RunLoop
. The timer may not
already be scheduled.
boolean scheduled;
int compare id other;