How to wait for a period of time using a timer