[python-win32] time. delay oddities
Tim Roberts
timr at probo.com
Wed Jan 26 18:31:38 CET 2005
On Tue, 25 Jan 2005 14:28:24 -080, Ray S <rays at blue-cove.com> wrote:
>With the pure Python code below, I get results like:
>micro sec: 1.0 12.2 154.8
>micro sec: 0.9 11.3 156.0
>when requesting 0, 10 and 160 us, which seems reasonable - PII600 Win2K Py2.2.
>
>On Linux with a 2GHz Py2.3 it seems to always return 0.0
>
>
Right. On Linux, time.clock() has a precision of 10 ms. None of your
calls take more than 10 ms, so the difference is always 0.
I can't tell what you're trying to achieve with this code. time.clock()
returns very different things on Windows and Linux. On Windows, it
returns (roughly) real time since the beginning of the process. On
Linux, it returns CPU time used since the beginning of the process.
Since sleep() does not use CPU time, clock() stops while you sleep.
What are you trying to achieve? Python is almost certainly the wrong
approach for a real-time process.
--
- Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-win32
mailing list