# Timer (problem)

**URL:** <https://forum.kirupa.com/t/timer-problem/142158>\
**Category:** Uncategorized\
**Created:** [March 26, 2005, 12:20am UTC](https://forum.kirupa.com/t/timer-problem/142158 "2005-03-26T00:20:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nathan99](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@nathan99](https://forum.kirupa.com/u/nathan99)\
**Post date:** [March 26, 2005, 12:20am UTC](https://forum.kirupa.com/t/timer-problem/142158/1 "2005-03-26T00:20:23Z")

</div>

I have this code for my timer, it counts down alright. BUT it is very buggy it most commonly counts down by 2 when it is meant to count down by one:\*( I have even watched my brother play our game and it went fron 20 to 7!!! any help would be greatly appreciated. If anyone could even give a code that counts down in minutes and seconds would be majorly appreciated. But yeh, I don’t know what is causing it so please help a man in need LOL:D

```auto

[left]var cur_timer = 180;function timer() 
{
if (cur_timer > 0) 
{ 
cur_timer--;
} 
else 
{ 
cur_timer = "Time up!"; 
gotoAndPlay("43") 
clearInterval (time_interval);
}
}
time_interval = setInterval(timer, 1000);[/left]
 

```
