On Dec 11, 2008, at 6:32 AM, Chunk 1978 wrote:

thanks everyone for the answers.

i agree that Ashley's method is far more readable than using modulus
calculations, so i'll look into that further as i can't seem to get it
working yet.

currently, i have this working using modulus calculations, but it
starts at 00 for the hours and minutes...

/* snip */

- (void)updateTime:(NSTimer *)theTimer
        {
        NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate];
        NSTimeInterval interval = now - startTime;

        //Tag #1 x 3600 Seconds = 3600 Seconds = 2 Hours.
        //Tag #2 x 3600 Seconds = 7200 Seconds = 2 Hours.
        //Tag #3 x 3600 Seconds = 10800 Seconds = 3 Hours.

        int hoursSelected = ([self timeMenuSelection] * 3600);

NSTimeInterval remaining = hoursSelected - second;

if (remaining >= 0)
        {
        int hours = remaining / 3600;
        int minutes = (remaining / 60) % 60;
        int seconds = remaining % 60;

        NSLog(@"%.2d %.2d %.2d ", hours, minutes, seconds);

                }
                else
                {
                NSLog(@"TIME'S UP!");
                [killTimer invalidate];
                [killTimer release];
                killTimer = nil;
                }
        }
_______________________________________________

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