terminate based on time