This tag is for questions about using timers in code to make things happen in a certain order or for gathering amount of time elapsed.

Timers can be used in a variety of ways.

Software timers as described on Wikipedia:

As the number of hardware timers in a computer system or processor is finite and limited, operating systems and embedded systems often use a single hardware timer to implement an extensible set of software timers. In this scenario, the hardware timer's interrupt service routine would handle house-keeping and management of as many software timers as are required, and the hardware timer would be set to expire when the next software timer is due to expire. At expiry, the interrupt routine would update the hardware timer to expire when the next software timer is due, and any actions would be triggered for the software timers that had just expired. Expired timers that are continuous would also be reset to a new expiry time based on their timer interval, and one-shot timers would be disabled or removed from the set of timers.

Compared to hardware timers, software timers typically offer considerably lower levels of time precision. Nevertheless, while simple in concept, care must be taken with software timer implementation if issues such as timer drift and delayed interrupts is to be minimized. In modern operating systems, software timer precision can be traded off further for CPU power savings, using a technique called timer coalescing.