timer: bugfix and test trigger_periodic (run/timer)

Fix #699