Hello,

how does a NSTimer object that has been setup with a repeating time interval calculate the time when it fires an event?

There may be two possibilities:
Say, the initial time is at t0, the interval is T, and the time when it fires the first event is at t1, the second at t2, etc.
The time when it fires the ith event will be ti:
A)
ti = t (i-1) + T

B)
ti = i * T + t0


Reason:
If I need a "tick" that corresponds to a current time, I would prefer method B (mean error remains stable). In case A the firing time may fade away with respect to the initial time due to inherent inaccuracies. Although this error is certainly small compared to the error that we have when we measure the time when we actually do handle the event, but it may accumulate over a long duration. That is the error increases with time.

Regards
Andreas



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to