Why does time.clock() return a wrong result?

python, python-2.7

Solution

`time.time()` and `time.clock()` are measuring different things.

`time.time()` measures wall clock elapsed time, since the Unix epoch.

On a Linux system, `time.clock()` is measuring processor time, which isn't the elapsed time in seconds.

Processor time is an approximation of how much time was spent by the processor executing that code, as defined in the `man` pages for `clock` (which is the underlying call to the operating system that `time.clock()` makes on a Linux system).

Python source: https://docs.python.org/2/library/time.html

Clock source: http://linux.die.net/man/3/clock

Problem

Why does `time.clock()` give the wrong result? The code is as follows: ``` time_start1 = time.time() time.sleep(5) bb = time.time() - time_start1; print bb; time_1 = time.clock() time.sleep(5) cc = time.clock() - time_1 print cc ``` The results are: ``` 5.00506210327 0.006593 ``` The second one should be 5.0, but why is it 0.006? My OS is Ubuntu 14.04LTS 64-bit. My version of IDLE is 2.7.6. Thanks!

Original source