sim: add support for periodic events.

These will be used for implementing timers etc.