[Tutor] python time

Dave Angel davea at ieee.org
Thu Nov 26 12:51:02 CET 2009

spir wrote:
> Hello,
> How does python get the time in microseconds? (In other words, how would I get it if python (like some other languages) would provide time in whole seconds only?)
> Thank you,
> Denis
> ________________________________
> la vita e estrany
> http://spir.wikidot.com/
You need to supply more information about your environment, and maybe 
the reason for asking.  Since you don't, I'll make some guesses.

If you're trying to do extremely fine delta-time measurements, there is 
a Pentium instruction to fetch the number of clock cycles.  You'd get 
this in assembler language, or with _asm in C code.

If you're on Windows, there is a NtQuerySystemTime() function exported 
by ntdll.dll.  It fetches a large integer specifying the number of 
100-ns intervals since some epoch time in 1601.  It's been deprecated, 
however, in favor of GetSystemTimeAsFileTime(), available in Win2k and 
later, and exported from kernel32.dll

There are others, but I can't find them at the moment.

More information about the Tutor mailing list