A reasonably accurate timer subsystem implemented in C