adding time logic