[Pythonmac-SIG] time.clock() and profile

Samuel M. Smith smithsm at samuelsmith.org
Fri Feb 13 11:59:44 EST 2004


On Feb 13, 2004, at 06:02, Jack Jansen wrote:

>> Is time.clock() in the time module broken on Python 2.3 Mac OSX 10.3.2
>>
>> It seems to give out very slowly changing times. As in minutes to 
>> change anything.
>
> Note that time.clock() does not return realtime (use time.time() for 
> that), it returns
> CPU seconds used by the current process. So if you type time.clock(), 
> then do nothing
> for three days, then type time.clock() again the two values should be 
> almost the same.

Now I get it! CPU time is elapsed time used by the CPU for a particular 
process. I ran some tests and the minimum resolution of CPU time 
returned by time.clock() on the Mac OSX Python is effectively .01 
seconds. Anything less is zero. (actually I could sometimes get 
.009999999980195 for the min resolution)




More information about the Pythonmac-SIG mailing list