Re: Elapsed time vs sleep

2010-07-27 Thread Fritz Anderson
On 27 Jul 2010, at 1:42 PM, Jeffrey Oleander wrote: > Whatever happened to hardware monitoring and control > of the CPU (core)? They are there. In the kernel. For user-space code, Darwin is not a real-time operating system. Period. Apple has been saying so for ten years or more. I'm not an exp

Re: Elapsed time vs sleep

2010-07-27 Thread Jeffrey Oleander
> On Mon, 2010/07/26, Kyle Sluder wrote: >> Charlie Dickman <3tothe...@comcast.net> wrote: >> As long as the NSTimer firing interval is >> sufficiently small the NSTimer can be used. >> If the run loop is stalled for any "significant: >> time _all_ timers will be inaccurate to some >> degree. > >

Re: Elapsed time vs sleep

2010-07-26 Thread Sherm Pendley
That depends on what you mean when you say "animation." NSTimer works fine for triggering screen updates. But if your animation is physics-based - a 3d "shooter" game, for instance - you'll want something like the aforementioned mach_absolute_time to keep the animation smooth. sherm-- On Mon, Jul

Re: Elapsed time vs sleep

2010-07-26 Thread Kyle Sluder
On Mon, Jul 26, 2010 at 9:27 AM, Charlie Dickman <3tothe...@comcast.net> wrote: > As long as the NSTimer firing interval is sufficiently small the NSTimer can > be used. If the run loop is stalled for any "significant: time _all_ timers > will be inaccurate to some degree. This is untrue. mach_a

Re: Elapsed time vs sleep

2010-07-26 Thread David Duncan
On Jul 26, 2010, at 9:27 AM, Charlie Dickman wrote: > As long as the NSTimer firing interval is sufficiently small the NSTimer can > be used. If the run loop is stalled for any "significant: time _all_ timers > will be inaccurate to some degree. The NSTimer works fine for animation and , > e.g.

Re: Elapsed time vs sleep

2010-07-26 Thread Charlie Dickman
As long as the NSTimer firing interval is sufficiently small the NSTimer can be used. If the run loop is stalled for any "significant: time _all_ timers will be inaccurate to some degree. The NSTimer works fine for animation and , e.g., alarm timers and they are consistent across platforms such

Re: Elapsed time vs sleep

2010-07-26 Thread Kyle Sluder
On Jul 26, 2010, at 8:32 AM, Charlie Dickman <3tothe...@comcast.net> wrote: > Try using an NSTimer with a repeating timeout interval of, say, .001 (or > anything smaller than your required accuracy), and countdown your time delta > by the same amount each time the NSTimer fires and when you get

Re: Elapsed time vs sleep

2010-07-26 Thread Charlie Dickman
Try using an NSTimer with a repeating timeout interval of, say, .001 (or anything smaller than your required accuracy), and countdown your time delta by the same amount each time the NSTimer fires and when you get to zero you'll have what you need. On Jul 26, 2010, at 4:56 AM, Matt Gough wrote:

Elapsed time vs sleep

2010-07-26 Thread Matt Gough
I need to calculate (with an accuracy of 0.1 of a second) a real-time time interval. This interval should: 1. Not be affected by whether the system has been put to sleep and woken up while timing. (i.e If I start the timer then sleep the Mac for an hour and wake it up again, my interval should