"Paul Rubin" <http://p..id> wrote:
>[EMAIL PROTECTED] (John Fisher) writes: >> mark start time >> start event >> event finishes >> count time until next interval >> start second event⦠>> >> rather than this: >> >> start event >> event finishes >> sleep for interval >> start second event >> ... >> So how do I accomplish this in Python with a minimum of labour? > >Normally I'd use something like: > > from time import time > > t0 = time() > start event ... event finishes > t1 = time() > elapsed = t1 - t0 > sleep(interval - elapsed) > start second event ... > >Am I missing something? Not much - only beware of cases when elapsed is greater than interval - not sure what time.sleep(negative_number) does. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list