base logic for timer