[issue14309] Deprecate time.clock()

STINNER Victor report at bugs.python.org
Mon Mar 19 13:46:57 CET 2012


STINNER Victor <victor.stinner at gmail.com> added the comment:

> There's no other single function providing the same functionality

time.clock() is not portable: it is a different clock depending on the OS. To write portable code, you have to use the right function:

 - time.time()
 - time.steady()
 - os.times(), resource.getrusage()

On Windows, time.clock() should be replaced by time.steady(). On UNIX, time.clock() can be replaced with "usage=os.times(); usage[0]+usage[1]" for example.

Which kind of use case is not covered by these functions?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14309>
_______________________________________


More information about the Python-bugs-list mailing list