
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
What about a StepReactor?
It would be great to be able to stop time, have a means to look at the event queue and to say "DispatchNextEvent" by hand. Or even better, "PushTimeForward(x)" and see what happens. In short, a simulator.
This assuming, of course, that all other parts of the system are pausable, be they internal or external.
- -- "It seems like Zope has done a dance with Twisted but still hasn't asked it out on a date." Paul Everitt
Nicola Larosa - nico@tekNico.net

On Thu, Jul 31, 2003 at 08:53:01AM +0200, Nicola Larosa wrote:
What about a StepReactor?
It would be great to be able to stop time, have a means to look at the event queue and to say "DispatchNextEvent" by hand. Or even better, "PushTimeForward(x)" and see what happens. In short, a simulator.
This assuming, of course, that all other parts of the system are pausable, be they internal or external.
Is reactor.iterate[1] sufficient for this?
-Andrew.
[1] http://twistedmatrix.com/documents/api/public/twisted.internet.interfaces.IR...

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Is reactor.iterate[1] sufficient for this?
Well, it does not stop time, and also calls runUntilCurrent. I guess one should come up with a substitute for time.time in t.i.base (at least), that would allow to manipulate (fake) time at will.
Also, some means to display the event queue is needed, including the delays for each event.
Come to think of it, is there a way in Twisted to schedule an event at an absolute time, instead of at a relative one?
- -- "It seems like Zope has done a dance with Twisted but still hasn't asked it out on a date." Paul Everitt
Nicola Larosa - nico@tekNico.net

Nicola Larosa nico@tekNico.net writes:
Come to think of it, is there a way in Twisted to schedule an event at an absolute time, instead of at a relative one?
Sure.
reactor.callLater(desiredTime - time.time(), func)
:-).
The reactor stores DelayedCalls with absolute times instead of relative ones internally. The callLater API accepts relative times because that's generally the most useful to work with.
-Brian

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Come to think of it, is there a way in Twisted to schedule an event at an absolute time, instead of at a relative one?
Sure.
reactor.callLater(desiredTime - time.time(), func)
:-).
Of course. :^)
The reactor stores DelayedCalls with absolute times instead of relative ones internally.
That's good to know.
The callLater API accepts relative times because that's generally the most useful to work with.
Very true, and arguably there's no point in coming up with some convention to specify absolute time, since the above syntax is clear enough.
- -- "I'm a Python fanatic these days, I find that I'm able to program about three times faster than I could in Java, and I was able to program in Java about three times faster than I could in C." Andy Hertzfeld
Nicola Larosa - nico@tekNico.net
participants (3)
-
Andrew Bennetts
-
Brian Warner
-
Nicola Larosa