Tobiah wrote:

> import time
> 
> while 1:
>         print time.clock()
> 
> This gave me a stream of floats, the integer part of which
> only updated about every three seconds.  Now, the manual
> also states:
> 
>       The precision, and in fact the very definition of the meaning 
>       of ``processor time'', depends on that of the C function of
 >       the same name
> 
> So I "man 3 clock" and notice:
> 
>       The value returned is the CPU time used so far as a clock_t;
 >       to get the number of seconds used, divide by CLOCKS_PER_SEC.
 >
> So, I'm wondering how to get that value from python.

by calling clock(), of course.

> All I really want to do is know current time relative to a given
> point so that I can capture MIDI events, and store the time at
 > which they arrive.

if you want real time, use time.time().

CPU time (processor time) is something different; that's based on how 
many CPU cycles your program has used up since it started (usually 
approximated by checking what process is running at regular intervals). 
  if your program doesn't do anything, or, as in your example, spends 
most of its time waiting for someone else to do something, it won't 
consume many cycles.

</F>

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to