time.time() strangeness

Nitro nitro at dr-code.org
Tue Feb 26 15:00:45 EST 2008


> The granularity of time.time can be quite large, maybe as much
> as 1 second in some systems.  Also, if the user can set the time,
> the output might not be monotone.  They might set the clock backwards
> if it has drifted ahead, or something like that.  Better to use an
> explicit counter if you need a monotonically increasing sequence.

It's not the granularity, after all it works without the single  
CreateDevice. With the line uncommented the value doesn't even change  
after 2 minutes.
I am not sure what you mean with explicit counter. I think I would still  
need to get some time delta to accumulate. However, time.time() -  
time.time() will always be 0 for obvious reasons.
I agree it would probably be better to use time.clock() and an explicit  
counter to prevent time wrapping issues. Nevertheless time.time()  
shouldn't fail here unless DirectX is really badly tinkering with my  
system.

Thanks for your answer,
-Matthias



More information about the Python-list mailing list