How to make a repeatedly timer with 5ms precision?

Irmen de Jong irmen at -NOSPAM-REMOVETHIS-xs4all.nl
Wed Apr 30 19:19:22 EDT 2003


卢剑雄 wrote:
> I am trying to make a repeatedly timer with high precision, the following
> program 'countdown.py' is an example which shows the way how I tried to
> make it. The problem is that it doesn't work properly with tick set to 5ms
> or smaller.

You might want to try your luck with select:

import select
select.select([],[],[],timeout)

where timeout can be small, 0.005 in your case (5 ms).
Don't know about select's precision, and the above almost
certainly doesn't work on Windows.

--Irmen





More information about the Python-list mailing list