Implement compatibility workaround for libevent timers on older compilers. See #647.