registers a timer function