TimeRemaining

TimeRemaining[]

gives the number of seconds remaining until the earliest enclosing TimeConstrained will request the current computation to stop.

Details

Examples

open allclose all

Basic Examples  (2)

After 1 second has elapsed, there are still 4 seconds remaining until the 5 second time constraint:

Do not play this audio if there is not enough time to finish it:

Properties & Relations  (4)

Without an enclosing TimeConstrained, TimeRemaining[] returns Infinity:

TimeRemaining[] returns the time to the earliest time constraint:

After 2 seconds, there are 3 seconds remaining until the outer constraint of 5 seconds:

TimeRemaining is based on absolute time ("wall clock time"), as measured by AbsoluteTiming:

The CPU time taken by the operation can be measured using Timing, and it is smaller:

The presence of AbortProtect may invalidate the times reported by TimeRemaining[]:

Introduced in 2020
 (12.1)