[Twisted-Python] accurate periodic call

Glyph glyph at twistedmatrix.com
Mon Feb 20 13:32:19 MST 2012


On Feb 20, 2012, at 12:52 PM, Phil Mayers wrote:

> On 20/02/12 14:29, exarkun at twistedmatrix.com wrote:
>> On 12:09 pm, p.mayers at imperial.ac.uk wrote:
>>> On 20/02/12 04:14, Itamar Turner-Trauring wrote:
>>>> See http://twistedmatrix.com/trac/ticket/2424
>>> 
>>> I find that ticket disturbing reading.
>>> 
>>> The original description seems to claim there is a logic bug in
>>> LoopingCall that is triggered when the clock goes back, but subsequent
>>> discussion is all about the pros and cons of monotonic clocks.
>>> 
>>> Is there such a bug, and if so should there be a separate ticket for
>>> it?
>> 
>> There is no such bug, as far as I am aware.
> 
> Phew! In which case, it's not disturbing. Thanks for the clarification.
> 
> Slightly confusing that the OP seemed to experience such a bug, but it 
> was 6 years ago I guess...

Well, it depends on how you define a "bug".  LoopingCall's internal state remains consistent, but if you set your clock backwards, LoopingCall won't fire your callback again until the system clock catches up to where it previously was.  Any new LoopingCalls that are created will work fine, although they will probably report an incorrect skipCount if you set the clock forward again.

This can be quite dramatic if you change the date, of course, but if you're talking about adjustments like NTP slew it's unlikely you'll notice it.

-glyph



More information about the Twisted-Python mailing list