Can some one help me out from the time calculation in form of hr:min:sec. But I does need the system time. That's for I made this code
I try to make time calculation in the form of hr:min:sec but it doesn't work in right way(it work till one hours)& ((1)after the 60 second output is 0:1:60 (2)after the 61 second output is 0:1:71 (3)after after the 3600 second output is 1:1:00 but(3)after the 3601 second output is wrong )
Here is the code:
In the .m file
-(IBAction)start
{
timer1 = [NSTimer scheduledTimerWithTimeInterval:(.01) target:self selector:@selector(timepassed) userInfo:nil repeats:YES];
}
-(void)timepassed
{
counter++;
if(sec==60)
sec=0;
else
sec=counter/100;
if(min==60)
min=0;
else
min=sec/60;
if(hr==24)
hr=0;
else
hr=min/60;
m1++;
NSString *l=[NSString stringWithFormat:@"%i:%i:%i",hr,min,sec];
[m setText:l];
}