Timer

New to Analytica 7.2

Experimental -- An experimental function is subject to change. To use, your model must import from the namespace SysLib_Experimental, or use a fully qualified name, SysLib_Experimental::Timer.

Struct Timer( expr, secondsFromNow, fireIfReleased )

Schedules «expr» to be evaluated at an idle moment about «secondsFromNow» seconds from now -- never in the middle of a computation, a model load, or a modal dialog.

Timer(expr, 0) means "as soon as the current work finishes". Returns a timer instance.

Read t->secondsFromNow for the time remaining (Null once it has fired), assign to it to re-arm, and assign Null or a negative number to cancel.

Releasing the instance cancels the timer unless you pass fireIfReleased:True, which lets it fire once even when nothing holds onto it. Timers fire only in the Analytica desktop application.

Experimental -- using Namespace import

To use an experimental function, your model should import from the SysLib_Experimental Namespace. If this is your only namespace import, you can set this from typescript using:

NamespaceImports MyModel: SysLib_Experimental

You can alternatively use a fully qualified name, SysLib_Experimental::Timer(...). The downside of doing so is that if the function later becomes non-experimental, then it will be removed from that namespace.

To fire at a specific time

Timer( DoIt(), 86400 * (t - Today(true) ) )

Where 86400 is the number of seconds in a day.

Comments


You are not allowed to post comments.