calculate delay necessary