Timer Functions

OBJECTS

  typedef void (*timerfn)(void *data);

FUNCTIONS

  int  settimer(unsigned millisec);			/* set timer time */
  void settimerfn(timerfn timeout, void *data);		/* set timer func */

  int  setmousetimer(unsigned millisec);	/* mouse down timer */
  void delay(unsigned millisec);		/* small pause */
  long currenttime(void);			/* in millisecs */

NOTES

The settimer function is used to start or stop a timer associated with the program. The argument millisec refers to the number of milliseconds between time-outs. If millisec is zero, the timer is stopped. When the timer times-out the call-back function set by the settimerfn function is called. The call-back is sent the specified data pointer and returns nothing.

The setmousetimer function sets a millisecond mouse-repeat delay to be used in all windows controlled by the application. If the user holds a mouse button down for longer than millisec in a window, the previous mouse event will be sent every millisec milliseconds to the current window or control's mouserepeat function (providing it has one). The mouserepeat function for a window can be set using setmouserepeat. This is similar to the way keyboard events will automatically repeat after holding a key down. If millisec is zero the mouse timer is halted. The mouse timer is initially set to repeat mouse events every tenth of a second.

The delay function suspends program operation for millisec milliseconds. This function should be used sparingly since it is a blocking function.

The currenttime function returns the number of milliseconds which have elapsed since the program began. This should not be relied upon as an accurate measure of time.