# setInterval timer problems

**URL:** <https://forum.kirupa.com/t/setinterval-timer-problems/62858>\
**Category:** flash\
**Created:** [September 1, 2004, 12:54am UTC](https://forum.kirupa.com/t/setinterval-timer-problems/62858 "2004-09-01T00:54:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![serkios](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/serkios/32/608_2.png) [@serkios](https://forum.kirupa.com/u/serkios)\
**Post date:** [September 1, 2004, 12:54am UTC](https://forum.kirupa.com/t/setinterval-timer-problems/62858/1 "2004-09-01T00:54:06Z")

</div>

I’m trying to make a timer that when started, begins a movie and tracks its progression in seconds, minutes, and hours. I’ve been using SetInterval to count tenths of a second for accuracy. My problem is the timer doesn’t seem to be keeping time correctly. I let it run for 30 seconds against my windows clock and always comes like 5-6 seconds short. Anyone know whats up with this? Would getTimer() be more accurate??

```auto

   playInterval = setInterval(timer, 100);
   function timer () {
   	tenths++;
   	if (tenths>= 10) {
   		tenths= 0;
   		seconds++;
   	}
   	if (seconds >= 60) {
   		seconds = 0
   		minutes++;
   	}
   	if (minutes >= 60) {
   		minutes = 0;
   		hours++;
   	}	
   	// Format the digits properly
   	if (seconds <= 9) {
   		sec = "0" + seconds;
   	} else {
   		sec = seconds;
   	}
   	if (minutes <= 9) {
   		min = "0" + minutes;
   	} else {
   		min = minutes;
   	}
   	if (hours <= 9) {
   		hrs = "0" + hours;
   	} else {
   		hrs = hours;
   	}
   	timeToShow = hrs +":" + min + ":" + sec;
   	_root.timestamps_mc.video_mc.timer_txt.text = timeToShow;
   	updateAfterEvent();
   }
   

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 1, 2004, 1:20am UTC](https://forum.kirupa.com/t/setinterval-timer-problems/62858/2 "2004-09-01T01:20:31Z")

</div>

I use get timer for all of my flashing. In all the tuts i have read it uses this method.

Hope that helped,
