Updated time logic