How to delay until a next increment of time occurs ?

Dietmar Schwertberger maillist at schwertberger.de
Wed Nov 13 13:41:27 EST 2019


On 13.11.2019 19:21, R.Wieser wrote:
> Yup. But the cost of using that command is generating threads - which 
> some
> search results warned against (not sure why though).

I'm currently looking for a way to have short breaks (in the range of 
10us to some ms) on Windows and time.sleep() always seems to be too 
long, probably due to thread switching.
 From looking at the source code, it could behave better with Linux, but 
anyway such solutions will always create a lot of Jitter.


> The best solution I can think of would be a build-in (hardware?) timer which
> would generate "ticks" until its stopped.

Actually, with such requirements you're usually better off with a 
microcontroller. These have timers and interrupts available. Maybe the 
PyBoard with Micropython is the right tool for you.
I'm using it for some measurement and control applications and it's 
really great.

Regards,

Dietmar




More information about the Python-list mailing list