I need to deal with a counter that gives me ticks for my application. The counter is 32bits so what i need to know is how to deal with it when it wraps. for example:
I h
The simplest way to do this is to make an "epoch counter", that explicitly counts rollovers. (Example: you have a hardware counter that counts seconds 0..59. Your epoch counter would count minutes, by incrementing each time it noticed that the seconds counter had rolled over.)
Your future_scheduler function then reads the current epoch and time,and computes a new epoch and time for your event.
Alternatively, you could just punt, and make your timing function count your event schedules down to zero on each timer tick.