[Pythonmac-SIG] time.clock() versus time.time() significant digits

Kevin Altis altis at semi-retired.com
Sun Sep 19 18:33:01 CEST 2004


I was looking at someone else's code today that had some time.clock() 
calls used to figure out how long an operation took. I was surprised to 
see on the Mac that there were only two significant digits after the 
decimal point compared to what I saw on Windows. Normally, I use 
time.time() for calculating time taken on an operation and my numbers 
on both systems seemed to have the same resolution. Anyway, I opened up 
the shell on the Mac and indeed it appears that time.time() is using 
more significant digits. Am I just misinterpreting the results here or 
is this a bug? I'm using the stock Panther Python 2.3.

 >>> time.time()
1095611259.1935749
 >>> time.time()
1095611263.9729979
 >>> time.time()
1095611273.4193349
 >>> time.clock()
6.8300000000000001
 >>> time.clock()
7.75

ka



More information about the Pythonmac-SIG mailing list