calculate time to execute