Simplify timer and make it compatible with Darwin