*thread shocked back to life* since this timer i'm writing is based on NSDate, it's effected if the computer's clock is manually changed... that i don't mind, because who really need to ever manually set their clock on the computer... however, i'm concerned that if (probably when) my timer is running during a daylight savings shift it will add/subtract an hour... i guess there's no avoiding this? or maybe apple took this into account and therefore currently running code is not effected by a daylight savings shift?
On Thu, Dec 11, 2008 at 6:00 PM, Chunk 1978 <chunk1...@gmail.com> wrote: > thanks a lot Ashley... works great! > > On Thu, Dec 11, 2008 at 2:35 PM, Ashley Clark <acl...@ghoti.org> wrote: >> Sorry forgot to mention you'll probably have to cast things to integer for >> modulo to work. My compiler flags make me at least. >> >> Ashley >> >> >> On Dec 11, 2008, at 1:25 PM, Ashley Clark wrote: >> >>> 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 = (int)(remaining / 60) % 60; >>> int seconds = (int)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/aclark%40ghoti.org >>> >>> This email sent to acl...@ghoti.org >>> >> >> > _______________________________________________ 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