- Home /
 
               Question by 
               dansav · Jul 03, 2012 at 11:33 PM · 
                iphonetimertime.deltatime  
              
 
              How do you make an Accurate Timer on iphone
I've been using the following to count time accurately on the iphone. I want something to happen every .1 seconds. Is this the best way to do it?
 var playtime=0.0;
In the update loop
 playtime+=Time.deltaTime;
 if(playtime>.1){
  playtime=0;
     playFrame();
  }
  
 
               Comment
              
 
               
              Answer by whydoidoit · Jul 04, 2012 at 03:54 AM
That isn't very accurate because you are setting playTime = 0 inside your test - ignoring the value above .1 I would suggest:
  if(playtime > 0.1) {
       playtime -= 0.1;
       playFrame();
  }
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                