The number of seconds. This may be fractional. Realistically the operating system will not be able to keep up with numbers below about 0.05. This will differ from machine to machine.
The actions to perform continuously every given number of seconds.
This function specifies an action to be performed every time the number of seconds elapses. The return value is a unique timer number which may be used to cancel the action prior to the time expiring by calling cancel. The number of seconds may be specified to arbitrary precision, but will be limited in fact by the timer resolution of the operating system. In most cases this is practically limited to 20 milliseconds (0.05 seconds).
The timer functions after, every and at all cause the action to occur at the specified time, regardless of what is happening at that time, except if the timer expires during garbage collection. In this case, the timer will be serviced as soon as the garbage collection finishes.
For Gamma to notice a timer, you must make a call to next_event. To notice repeating timers, the call to next_event can be used with a call to while(t).
Print hello every 5 seconds.
Gamma> every(5, #princ("Hello\n"));
1
Gamma> while(t) next_event();
Hello
Hello
Hello
...
See the Automatically Change SP Value section or the Emulating the PID Loop section of the PID Emulator chapter, or the GTK: Recording Data section or the Photon: Recording Data section of the History Functions chapter in the Cogent Tools Demo and Tutorials book for examples of this function used in context.