[Twisted-Python] timer granularity

Andrew Bennetts andrew-twisted at puzzling.org
Fri Sep 13 21:57:42 EDT 2002

On Fri, Sep 13, 2002 at 03:02:51PM +0000, Jeremy Noetzelman wrote:
> What is the timer granularity in twisted?  Is it possible to have
> subsecond event timers in Delayed or am I limited to integer seconds?

Firstly, Delayed is deprecated.  See
for documentation on the correct way to schedule tasks in current Twisted.

Secondly, yes Twisted supports sub-second event timers.  The timing is done
using the OS's select(2) call (or poll(2), or kqueue, etc, depending on
which reactor you're using).  select(2)'s man page *claims* it supports
microsecond resolution, but my suspicion is that you probably can't rely on
more than about millisecond resolution.

As far as using sub-second precision, simply pass a float rather than an
integer to reactor.callLater, and it will "just work".


More information about the Twisted-Python mailing list