In C, is there a way to start a timer using setitimer, then pause it, then resume the timer with the time remaining when it was paused? My initial thought was to save the time left by using getitimer, stop the timer, then set the timer back to the saved value in getitimer, but this doesn't seem to be working.
Asked
Active
Viewed 619 times
3
-
As I know, there is no way to pause itimer. What is not working with your code? – osgx Apr 29 '12 at 21:40
1 Answers
1
You cannot pause a timer. Saving the time remaining, stopping the timer and then starting a new timer is the way to do this. That method does work so I guess you have a bug in your code.

David Heffernan
- 601,492
- 42
- 1,072
- 1,490
-
Oops, this is the way to go. Turns out I was using a virtual alarm in one spot and a regular alarm in another. Set them both to virtual and got the behavior I wanted. Thanks. – Anthony C. Apr 29 '12 at 22:04
-
By the way, you ought to read the [faq] and learn about voting and accepting. Please review your other questions. – David Heffernan Apr 30 '12 at 03:59