Magnus Lycka wrote:
> Shane Hathaway wrote:
> 
>>time.time() measures real time, while time.clock() measures the time the 
>>CPU dedicates to your program. 
> 
> 
> I suppose that varies with the platform... "help(time.clock)" says:
> 
> Help on built-in function clock:
> 
> clock(...)
>      clock() -> floating point number
> 
>      Return the CPU time or real time since the start of the process or 
> since
>      the first call to clock().  This has as much precision as the 
> system records.
> 
> Another thing to notice is that depending on OS, either time.time() or
> time.clock() might have much higher precision than the other.

I didn't notice that.  Thanks.

However, isn't this thoroughly un-Pythonic?  No wonder people have to 
ask.  Wouldn't it be better to have:

   time.time() -> real time, with as much precision as the platform
     provides.  Does not wrap around.

   time.cputime() -> CPU time, or real time on platforms that don't
     measure CPU time separately from real time.  May wrap around in
     long-running processes.

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

Reply via email to