> On 3 Feb 2022, at 04:45, Cecil Westerhof via Python-list > <python-list@python.org> wrote: > > Have to be careful that timing keeps correct when target takes a 'lot' > of time. > Something to ponder about, but can wait. You have noticed that your class does call the function at the repeat interval but rather at the repeat interval plus processing time. The way to fix this is to subtract the last processing elapsed time for the next interval. Sort of a software phase locked loop. Just before you call the run function record the time.time() as start_time. Then you can calculate next_interval = max( .001, interval - time.time() - start_time) I use 1ms as the min interval. Barry -- https://mail.python.org/mailman/listinfo/python-list
- Re: Waht do you ... 2QdxY4RzWzUUiLuE
- Re: Waht do you ... Chris Angelico
- Re: Waht do you ... 2QdxY4RzWzUUiLuE
- Re: Waht do you ... Chris Angelico
- Re: Waht do you ... Cecil Westerhof via Python-list
- Re: Waht do you ... 2QdxY4RzWzUUiLuE
- Re: Waht do you thin... Chris Angelico
- Re: Waht do you ... Cecil Westerhof via Python-list
- Re: Waht do you ... Chris Angelico
- Re: Waht do you ... Cecil Westerhof via Python-list
- Re: Waht do you ... Barry
- Re: Waht do you ... Cecil Westerhof via Python-list
- Re: Waht do you ... Martin Di Paola
- Re: Waht do you think about my re... Albert-Jan Roskam
- Re: Waht do you think about my repeated_ti... Cecil Westerhof via Python-list
- Re: Waht do you think about my repeated_ti... Cecil Westerhof via Python-list
- Re: Waht do you think about my repeat... Ethan Furman
- Re: Waht do you think about my re... Cecil Westerhof via Python-list
- Re: Waht do you think about m... Igor Berger
- Re: Waht do you think abo... Cecil Westerhof via Python-list
- Re: Waht do you think abo... Avi Gross via Python-list