![](https://secure.gravatar.com/avatar/3b1704542e4ad7f5fb303b631be59d71.jpg?s=120&d=mm&r=g)
-----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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/KLzLXv0hgDImBm4RApH3AJ0SqGfDLxmdI7GjrWBBzGOlbI3V3QCfdUyB bQkgGavTvpi1WnWpI6aO/Gg= =Jsn5 -----END PGP SIGNATURE-----
![](https://secure.gravatar.com/avatar/b3407ff6ccd34c6e7c7a9fdcfba67a45.jpg?s=120&d=mm&r=g)
On Thu, Jul 31, 2003 at 08:53:01AM +0200, Nicola Larosa wrote:
Is reactor.iterate[1] sufficient for this? -Andrew. [1] http://twistedmatrix.com/documents/api/public/twisted.internet.interfaces.IR...
![](https://secure.gravatar.com/avatar/3b1704542e4ad7f5fb303b631be59d71.jpg?s=120&d=mm&r=g)
-----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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/KNEPXv0hgDImBm4RAimdAJ4s8PWHqWSMqCjnvcaqJChANcCULgCguOPT duew65Z064oPnTJ1euBg4Y0= =kExV -----END PGP SIGNATURE-----
![](https://secure.gravatar.com/avatar/0f15c04b6acde258bd27586371ae94b1.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/3b1704542e4ad7f5fb303b631be59d71.jpg?s=120&d=mm&r=g)
-----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?
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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/K2OPXv0hgDImBm4RAnytAKCR5qWWWY74+t1liIW/3t9//3aZAgCaA4N6 zT/0F9U83zVGYzb09YwqUKQ= =VD4g -----END PGP SIGNATURE-----
![](https://secure.gravatar.com/avatar/b3407ff6ccd34c6e7c7a9fdcfba67a45.jpg?s=120&d=mm&r=g)
On Thu, Jul 31, 2003 at 08:53:01AM +0200, Nicola Larosa wrote:
Is reactor.iterate[1] sufficient for this? -Andrew. [1] http://twistedmatrix.com/documents/api/public/twisted.internet.interfaces.IR...
![](https://secure.gravatar.com/avatar/3b1704542e4ad7f5fb303b631be59d71.jpg?s=120&d=mm&r=g)
-----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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/KNEPXv0hgDImBm4RAimdAJ4s8PWHqWSMqCjnvcaqJChANcCULgCguOPT duew65Z064oPnTJ1euBg4Y0= =kExV -----END PGP SIGNATURE-----
![](https://secure.gravatar.com/avatar/0f15c04b6acde258bd27586371ae94b1.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/3b1704542e4ad7f5fb303b631be59d71.jpg?s=120&d=mm&r=g)
-----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?
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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/K2OPXv0hgDImBm4RAnytAKCR5qWWWY74+t1liIW/3t9//3aZAgCaA4N6 zT/0F9U83zVGYzb09YwqUKQ= =VD4g -----END PGP SIGNATURE-----
participants (3)
-
Andrew Bennetts
-
Brian Warner
-
Nicola Larosa