Precise timings ?

Michael Hudson mwh at python.net
Tue Aug 30 16:29:40 EDT 2005


Madhusudan Singh <spammers-go-here at spam.invalid> writes:

> Hi
>
> I am using time.clock() to get the current time of the processor in seconds.
> For my application, I need really high resolution but currently seem to be
> limited to 0.01 second. Is there a way to specify the resolution (say 1-10
> microseconds) ? 

Not in standard Python.

> My processor is a 1.4 MHz Intel processor.

Mhz? :)

> Surely, it should be able to report times a few (or at least 10)
> microseconds apart.

It's probably architecture and operating system dependent.  The
pentium has a timestamp counter that counts clock cycles and the
PowerPC has a similar (but slower) counter.  You may need to write a
little C or asm.

Cheers,
mwh

-- 
  All of us in here are guilty as hell.  Justified, yes, but guilty.
 "and that, your honour, was when I killed him"
 "Well, I see.  That's all right then"
                                                   -- Devin Rubia, asr



More information about the Python-list mailing list