5.3.2.3. The TIMERS variable:

On startup of a Gamma program a variable called TIMERS is initialized. This variable is an array of all the timers currently in the system. Initially, its value is [ ] (an empty array) but as timers are added to the system this array grows.

Gamma> TIMERS;
[]
Gamma> a = every(3,#princ("Hello\n"));
1
Gamma> >TIMERS;
[[860700531 176809668 3 ((princ "Hello\n")) 1]]
	  

The TIMERS variable was initially an empty array. Once the first timer was added the TIMERS variable contained information on the first timer. The contents of each element can be summarized as:

second nanosecond repeat function timer_id
		

The second is the number of seconds since Jan. 1, 1970 which is compatible with the clock and date functions. The nanosecond is the fraction of the second. Combining these two times gives an accurate time that identifies the next time the timer will fire. The repeat is nil if the timer is a once-only "after" timer or an "at" timer. Otherwise, this is the period of an "every" timer. The next item is the code that is evaluated when the timer fires. The last item in this sub-array is the timer-id.

This array grows as timers are added to the system:

Gamma> b = every(5, #princ("Test\n"));
2
Gamma> _timers_;
[[860700531 176809668 3 ((princ "Hello\n")) 1]
[860700563 494732737 5 ((princ "Test\n")) 2]]
Gamma> 
		

An important point to remember is that the TIMERS variable is an array, and therefore can be referenced as such. To reference the first element in the TIMERS array, use TIMERS [0] just like a regular array reference. Altering the TIMERS array can cause unpredictable behavior, and should be avoided.