I misunderstood the time.clock() function. It counts the CPU time while the process is active, whereas a monotonic clock counts elapsed time even during a sleep. time.clock() and time.monotonic() are different clocks for different purposes.
I wrote the PEP 418 which contains a list of all available OS clocks. It lists monotonic clocks, but also "process time" and "thread time" clocks. And it has a "Deferred API: time.perf_counter()" section.
Something can be done to provide portable functions to get the user and system times. See for example Tools/pybench/systimes.py written by Marc-Andre Lemburg.
Python 3.3 gives access to clock_gettime(CLOCK_PROCESS_CPUTIME_ID) and clock_gettime(CLOCK_THREAD_CPUTIME_ID). |