TimeConstrained

WMA link


TimeConstrained[expr, t]

evaluates expr, stopping after t seconds.

TimeConstrained[expr, t, failexpr]

returns failexpr if the time constraint is not met.

Possible issues: for certain time-consuming functions (like simplify)
which are based on sympy or other libraries, it is possible that
the evaluation continues after the timeout. However, at the end of the evaluation, the function will return $Aborted and the results will not affect
the state of the Mathics3 kernel.

SessionTime
TimeRemaining