## wb_create_timer

bool wb_create_timer (int window, int id, int interval)

Creates a timer in the specified window. The timer must be given an integer id that must be unique to all timers and controls. interval specifies the time-out value in milliseconds. Timer events are passed to and processed by the window callback function. A call to wb_destroy_timer() destroys the timer.

Low resolution and high resolution timers

This function supports both conventional (low-resolution) and multimedia (high-resolution) timers. Use a non-negative id to specify a low-resolution timer or a negative id to specify a high-resolution timer. Hi-res timers have a 10:1 increase in speed (resolution can go down to 1 ms opposed to 10 ms of a conventional timer) and much higher precision.

NOTE: Only one high-resolution timer is allowed per application and it must be on the main window.

# Example

`// A very simple digital clock define("ID_APP_TIMER", 201); $mainwin = wb_create_window(NULL, PopupWindow, date("h:i:s A"), 120, 0); wb_set_handler($mainwin, "process_main"); wb_create_timer($mainwin, ID_APP_TIMER, 1000); // One second interval wb_main_loop(); function process_main($window, $id) { switch($id) { case ID_APP_TIMER: // Show the current time in hours, minutes and seconds wb_set_text($window, date("h:i:s A")); break;` `case IDCLOSE: wb_destroy_window($window); break; } }`

# See also

wb_destroy_timer
System functions
Callback functions and window handlers