Anomaly in time.clock()

Roel Schroeven rschroev_nospam_ml at
Mon Mar 17 19:18:19 CET 2008

Godzilla schreef:
> Hello,
> I have been reading a thread about time.clock() going backward, which
> is exactly what I am seeing... the thread generally leaning toward the
> problem is caused by multi-processor machines. But I am seeing it at a
> single CPU computer, and running XP.
> The error I am seeing between two very close invokation of
> time.clock() is always around 3.5 seconds! This is enough to throw a
> lot of the timing requirement in the software out of the window...
> this is a fairly serious problem.

I don't know if it's the same problem, but I've seen something similar 
to this. Are you by any chance using DirectX? When you create a DirectX 
device, DirectX by default resets the precision of the CPU to 20 bits or so.

I had that problem in a project at work, with similar results (and other 
strange calculation errors). The solution was to use a flag 
(PRESERVE_PRECISION or something like that) in the CreateDevice() call 
(it was a C++ project).

If it's something else, I'm afraid I can't help.

The saddest aspect of life right now is that science gathers knowledge
faster than society gathers wisdom.
   -- Isaac Asimov

Roel Schroeven

More information about the Python-list mailing list