Calculating Elapsed Time

Fredrik Lundh fredrik at pythonware.com
Wed Dec 7 12:06:24 EST 2005


Grant Edwards wrote:

> >> Going by memory, Linux will generally be 1ms resolution (I might be
> >> off by 10 there...), while Windows XP has about 64 ticks per second,
> >> so .015625 resolution...
> >
> > here's a silly little script that measures the difference between
> > two distinct return values, and reports the maximum frequency
> > it has seen this far:
> >
> > if I run this on the Windows 2K box I'm sitting at right now, it settles
> > at 100 for time.time, and 1789772 for time.clock.  on linux, I get 100
> > for time.clock instead, and 262144 for time.time.
>
> At least under Linux, I suspect you're just measuring loop time
> rather than the granularity of the time measurement.

Yeah, I said it was silly.  On the other hand, the Linux box is a lot faster
than the Windows box I'm using, and I do get the same result no matter
what Python version I'm using...

(and in this context, neither 262144 nor 1789772 are random numbers...)

</F>






More information about the Python-list mailing list