I've been searching for any code snippets or libraries that would help with creating a basic timer that would

1. allow the user to enter a time (e.g., 5:00)
2. allow the user to stop the timer (e.g., 4:15)
3. allow the user to resume or re-start the countdown timer at the time she stopped it (e.g., 4:15)

From the best I've been able to find so far it looks like a clearInterval or clearTimeout function should be used, but I'm not really sure. Any suggestions? Thanks.