Porting VC++ SetWaitableTimer to gcc
I've legacy code that uses SetWaitableTimer to perform some task at 10 sec after midnight.
SetWaitableTimer
has the following feature, which is used in the code:
If the system tim开发者_如何学JAVAe is adjusted, the due time of any outstanding absolute timers is adjusted.
I'm porting code to gcc/Linux. How I can simulate the above behaviour?
This is a pretty good overview of linux timer functions. You want the timer_create()
/ timer_delete()
family with CLOCK_REALTIME
, then timer_settime()
with TIMER_ABSTIME
. According to this FAQ it should be adjusted if there is a change to the system clock though I have never tested it.
精彩评论