Using timer interrupts in a library