time.clock()

Tobiah toby at rcsreg.com
Fri Jul 14 05:13:22 EDT 2006


The manual says:

	On Unix, return the current processor time as a 
	floating point number expressed in seconds.

So I ran this program:

#!/usr/bin/python

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.  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.  Am I barking up the wrong tree?

Thanks,

Toby

-- 
Posted via a free Usenet account from http://www.teranews.com




More information about the Python-list mailing list