Wraparound problems with time.clock() on Linux

Carsten Gaebler news at snakefarm.org
Wed Apr 9 18:36:47 EDT 2003


In article <b722km$bau$2 at peabody.colorado.edu>, Fernando Perez wrote:
> Sorry, scratch that.  I went looking further in the docs, and it seems that
> time.clock() calls the system's clock(). From man clock:
> 
>        Note  that  the  time  can  wrap  around.   On  a  32bit  system 
> where
>        CLOCKS_PER_SEC  equals 1000000 this function will return the same
> value
>        approximately every 72 minutes.
> 
> 

> Anyone know of a reliable way to time long-running codes?

Without having tested it for more than 72 minutes, I'd try resource.getrusage().

cg.




More information about the Python-list mailing list