A timer is a counter whose input is a clock of known frequency. Counting cycles is the same as measuring time: at 1 MHz, each count is 1 µs.
A typical microcontroller timer is a synchronous mod n counter:
- it counts up on every tick (sometimes after a divider called a prescaler slows the clock first);
- when it reaches the value in a period or compare register it raises a flag or interrupt and goes back to 0.
Because the clear is synchronous, the counter must sit in N − 1 for the last full period, so many timers ask you to write N − 1 into the period register to get N ticks per cycle. That's the same off-by-one as any synchronous-clear mod-N counter.
Timers blink LEDs, generate PWM for motors, time out serial links and schedule tasks. A down counter works just as well: load the count, count to 0, raise a flag.