add timer function.