<br><br><div class="gmail_quote">On Mon, Feb 20, 2012 at 12:14 PM, Itamar Turner-Trauring <span dir="ltr">&lt;<a href="mailto:itamar@itamarst.org">itamar@itamarst.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 02/19/2012 11:49 AM, Zoran Bošnjak wrote:<br>
&gt; Hello all,<br>
&gt; I was astonished to find out that looping call period depends on the system time by default. The periodic tick can even stall for a long time, if the system time jumps backwards during program execution. It turned out that this is in fact a python problem (not providing a monotonic time, at least not for posix).<br>

&gt;<br>
&gt; I urgently need accurate periodic call in my program and I&#39;ve found the solution below that seems to be working. I kindly ask you for your comments:<br>
&gt; - Is this monotonic_time implementation OK from python perspective?<br>
</div>I didn&#39;t read it in detail, but it seems vaguely plausible; overriding<br>
reactor.seconds is the thing to do.<br>
<div class="im">&gt; - Is monkey patch to the reactor OK or is there any other solution more appropriate in this case (I do not want to patch each looping call, but once in the application)?<br>
</div>That&#39;s probably the easiest in this situation.<br>
<div class="im">&gt; - Does this patch have any negative influence to the rest of the reactor?<br>
</div>Everything is *supposed* to use reactor.seconds - grep for time.time and<br>
see if it shows up anywhere in twisted.internet.<br>
<div class="im">&gt; - How would you implement a periodic function call in twisted application (as accurate as possible)?<br>
</div>LoopingCall if you had this patch.<br>
<div class="im">&gt; - Any chance to see something implemented inside twisted and/or python, so that applications don&#39;t need this kind of tricks?<br>
&gt;<br>
</div>See <a href="http://twistedmatrix.com/trac/ticket/2424" target="_blank">http://twistedmatrix.com/trac/ticket/2424</a> - using ctypes is probably<br>
easier than the C extension the included patch provides.<br>
<div class="HOEnZb"><div class="h5"> </div></div></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a></div></div></blockquote><div><br></div><div>Does it work on windows?? </div>
</div><br>