[Twisted-Python] time

Antony Kummel antonykummel at yahoo.com
Mon Sep 5 09:44:05 EDT 2005

--- Jeff Grimmett <grimmtooth at gmail.com> wrote:

> On 9/5/05, Antony Kummel <antonykummel at yahoo.com>
> wrote:
> > 
> > Hi,
> > 
> > I noticed that the convention in Twisted is to
> measure
> > time with python.runtime.seconds. This in turn
> uses
> > time.time which is sensitive to the system clock,
> > meaning that it may return decreasing values if
> the
> > user sets the system clock to an earlier time
> between
> > calls. This would likely break many things, no?
> Why
> > not use time.clock or some combination between
> them?
> > 
> Seems to me that using the same clock as the rest of
> the system is the 
> single best way to ensure that other logs and
> Twisted's logs agree on the 
> time stamp.
> Just imagine the nightmare if there was an issue
> pointed to by the twisted 
> log, but since it was "correct" it couldn't be
> directly matched up with 
> another system log that actually pointed to the
> source of the problem.
> This has actually proven to be quite useful for me.

For logging, I agree, but the system clock is used for
many purposes, among them, for example, the mechanics
of LoopingCall, or the reactor's scheduling of delayed
calls, I think (please correct me if I'm wrong).

So it seems to me that while an application that uses
the current method may produce more useful logs but it
will also exhibit undefined behavior regarding the
rest of its functionality, no?

Antony Kummel

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

More information about the Twisted-Python mailing list