Automatically set max exection time

Hello

I’m using set_time_limit() to change the max_execution_time for a given script. However my script has different execution time every time it is ran, so i can use the same value for the function parameter every time. How can I know how long will the script take and change the max execution time accordingly?

thanks

why don’t you set it just to infinite?

set_time_limit(0);?

Still what if I want to know how long will my script take, is there a way?

record current time at the start and the end of the script and then subtract.

or you want to predict execution time? a deck of tarot cards may help you