Pulse Timer
  by Justice (Kwon J. Ekstrom)
Updated: June 13, 2006

Special thanks to:
Hypereye for the use of his server as a test site.
Trax, for writing the C code this is based on.

This code is used to handle delayed events.  It uses an ordered list
to speed up execution, and a hashtable to speed up inserting new events.

It uses internal counters to keep track of pulses, rather than the system
clock.  The timer must be manually updated using the advance() method.
Values are added to the timer using the push(value,delay) method.  The delay
is in pulses.

The pulse_timer object is a template, and takes the type of value, and the
hash size as parameters.  The size of the hash table will affect the
distribution of values within the table, in turn affecting performance.
You may wish to tweak this value depending on the types of delay you are

// Declaring:  type/hash size
pulse_timer<CHAR_DATA, 10> test_timer;

// Handling:
void handle_timer()
    CHAR_DATA *cur;
    while((cur = test_timer.pop()))
        send_to_char("Times Up!\r\n", cur);

// Adding Values:
test_timer.push(value, delay);