ctimersetitimer

Pausing a timer using setitimer?


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.


Solution

  • 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.